One of the two distinct must appear exactly once . Either the first entry appears once , or it appears n / k - 1 times to make other substring appear once .
if ( ( mp . begin ( ) -> second == ( n / k - 1 ) ) || mp . begin ( ) -> second == 1 ) return true ; return false ; }