LearnPy Hub
← Dictionaries problems
Hard

Where Do Anagrams Start?

Read a text t and a pattern p (small letters). Print every position (from 0) where a piece of t as long as p is an anagram of p, on one line, or none. Slide a window and keep letter counts in a dictionary, updating it by one letter in and one out.

Input

Two lines.

Output

One line.

Sample 1

Input
cbaebabacd
abc
Output
0 6

Sample 2

Input
abab
ab
Output
0 1 2
solution.py
Output appears here
Where Do Anagrams Start? · Python practice problem · LearnPy Hub