isShuffle modified to cache the strings which cannot produce valid shuffle