Loading...
Loading...
Loading...
A login tool stores a short code word w. Print YES if some block of the long text s is a rearrangement of w, and NO otherwise.
Example 1
Input
ab eidbaooo
Output
YES
The block "ba" is a rearrangement of "ab".
Example 2
Input
ab eidboaoo
Output
NO
No block is "ab" or "ba".
Try the problem first. Open one hint at a time.
This is the same as asking whether any block of the length of w has the same letter counts.
Slide a Counter along the text.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor