Function that returns true if sub - string s [ 0. . . k ] is repeated a number of times to generate String s
static boolean check ( String s , int k ) { for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( i % k ) ) { return false ; } } return true ; }