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