class Solution(object):
    def findAnagrams(self, s, p):
        """
        :type s: str
        :type p: str
        :rtype: List[int]
        """
        ans = []
        # sliding window
        for i in xrange(len(s) - len(p) + 1):
            if sorted( s[i: i + len(p)] ) == sorted( p ):
                ans.append(i)
        return ans

2c68b12f3a40cb5917e420b685dcd741254b204a
<mask token>

class Solution(object):
    <mask token>

class Solution(object):

    def findAnagrams(self, s, p):
        """
        :type s: str
        :type p: str
        :rtype: List[int]
        """
        ans = []
        for i in xrange(len(s) - len(p) + 1):
            if sorted(s[i:i + len(p)]) == sorted(p):
                ans.append(i)
        return ans

class Solution(object):
    def findAnagrams(self, s, p):
        """
        :type s: str
        :type p: str
        :rtype: List[int]
        """
        ans = []
        # sliding window
        for i in xrange(len(s) - len(p) + 1):
            if sorted( s[i: i + len(p)] ) == sorted( p ):
                ans.append(i)
        return ans
