fork download
  1. class Solution:
  2. def isAnagram(self, s: str, t: str) -> bool:
  3. list1 = [0]*26
  4. list2 = [0]*26
  5. if len(s) != len(t):
  6. return False
  7. for c1,c2 in zip(s,t):
  8. list1[ord(c1) - ord('a')] += 1
  9. list2[ord(c2) - ord('a')] += 1
  10. print(list1)
  11. print(list2)
  12. return list1 == list2
  13.  
Success #stdin #stdout 0.1s 14072KB
stdin
Standard input is empty
stdout
Standard output is empty