text: Function to find the final direction
code: < ? php function findDirection ( $ s ) { $ count = 0 ; $ d = " " ; for ( $ i = 0 ; $ i < strlen ( $ s ) ; $ i ++ ) { if ( $ s [ 0 ] == ' ' ) return null ; if ( $ s [ $ i ] == ' L ' ) $ count -= 1 ; else { if ( $ s [ $ i ] == ' R ' ) $ count += 1 ; } }