Print all possible strings that can be made by placing spaces | Function to print all subsequences ; Driver code
< ? php function printSubsequences ( $ str ) { $ n = strlen ( $ str ) ; $ opsize = pow ( 2 , $ n - 1 ) ; for ( $ counter = 0 ; $ counter < $ opsize ; $ counter ++ ) { for ( $ j = 0 ; $ j < $ n ; $ j ++ ) { echo $ str [ $ j ] ; if ( $ counter & ( 1 << $ j ) ) echo " ▁ " ; } echo " STRNEWLINE " ; } } $ str = " ABC " ; printSubsequences ( $ str ) ; ? >