get first element
while ( count [ index ] == 0 ) index ++ ; int prev = index ; String prevString = sortedArr [ prev ] ; index ++ ; for ( ; index < maxLen ; index ++ ) { if ( count [ index ] != 0 ) { String current = sortedArr [ index ] ; if ( current . Contains ( prevString ) ) { prev = index ; prevString = current ; } else { Console . WriteLine ( " Cannot ▁ be ▁ sorted " ) ; return ; } } }