A Function to find the string having the minimum length and returns that length
int findMinLength ( string arr [ ] , int n ) { int min = INT_MAX ; for ( int i = 0 ; i <= n - 1 ; i ++ ) if ( arr [ i ] . length ( ) < min ) min = arr [ i ] . length ( ) ; return ( min ) ; } bool allContainsPrefix ( string arr [ ] , int n , string str , int start , int end ) { for ( int i = 0 ; i <= n - 1 ; i ++ ) for ( int j = start ; j <= end ; j ++ ) if ( arr [ i ] [ j ] != str [ j ] ) return ( false ) ; return ( true ) ; }