Mr_HO1A

Crio Qurstoion1

May 8th, 2019
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. def dist(s1, s2):  
  2.      
  3.     count = 0
  4.     char_count = [0] * 26
  5.      
  6.     for i in range(26):
  7.         char_count[i] = 0
  8.  
  9.     for i in range(len( s1)):  
  10.         char_count[ord(s1[i]) -
  11.                    ord('a')] += 1
  12.  
  13.     for i in range(len(s2)):  
  14.         char_count[ord(s2[i]) - ord('a')] -= 1
  15.         if (char_count[ord(s2[i]) -
  16.                        ord('a')] < 0) :
  17.             count += 1
  18.  
  19.     return count
  20.  
  21. for _ in range(int(input())):
  22.     str1, str2 = input().split()
  23.     print(dist(str1,str2))
Add Comment
Please, Sign In to add comment