text: 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 ; Length of the string ; Count of positions for spaces ; Count of possible strings ; Driver Code
code: #include <math.h> NEW_LINE #include <stdio.h> NEW_LINE #include <string.h> NEW_LINE long long int countNumberOfStrings ( char * s ) { int length = strlen ( s ) ; int n = length - 1 ; long long int count = pow ( 2 , n ) ; return count ; } int main ( ) { char S [ ] = " ABCD " ; printf ( " % lld " , countNumberOfStrings ( S ) ) ; return 0 ; }