Count all possible strings that can be generated by placing spaces | C # program to implement the above approach ; Function to count the number of strings that can be generated by placing spaces between pair of adjacent characters ; Count of positions for spaces ; Count of possible strings ; Driver Code
using System ; class GFG { static long countNumberOfStrings ( String s ) { int n = s . Length - 1 ; long count = ( long ) ( Math . Pow ( 2 , n ) ) ; return count ; } public static void Main ( String [ ] args ) { string S = " ABCD " ; Console . WriteLine ( countNumberOfStrings ( S ) ) ; } }