Function to return the count of all possible sub - strings of str that are also the prefixes of str
public static int countSubStrings ( String str , int n ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) {