from collections import Counter


class Solution:
    def findTheDifference(self, s, t):

        s = dict(Counter(s))
        t = dict(Counter(t))

        for key in t.keys():
            if key not in s.keys():
                s[key] = 0
            if s[key] - t[key] <= -1:
                return key


if __name__ == '__main__':

	test_case = Solution()
	s, t = [input() for _ in range(2)]
	print('\n' + test_case.findTheDifference(s, t))
from collections import Counter


class Solution:
    def findTheDifference(self, s, t):

        s = Counter(s)
        t = Counter(t)

        for key in t.keys():
            if s[key] != t[key]:
                return key



if __name__ == '__main__':

	test_case = Solution()
	s, t = [input() for _ in range(2)]
	print('\n' + test_case.findTheDifference(s, t))
Refactor to remove nested for loop
Refactor to remove nested for loop

  from collections import Counter
  
  
  class Solution:
      def findTheDifference(self, s, t):
  
-         s = dict(Counter(s))
+         s = Counter(s)
-         t = dict(Counter(t))
+         t = Counter(t)
  
          for key in t.keys():
-             if key not in s.keys():
-                 s[key] = 0
-             if s[key] - t[key] <= -1:
+             if s[key] != t[key]:
                  return key
+ 
  
  
  if __name__ == '__main__':
  
  	test_case = Solution()
  	s, t = [input() for _ in range(2)]
  	print('\n' + test_case.findTheDifference(s, t))
Refactor to remove nested for loop
## Code Before:
from collections import Counter


class Solution:
    def findTheDifference(self, s, t):

        s = dict(Counter(s))
        t = dict(Counter(t))

        for key in t.keys():
            if key not in s.keys():
                s[key] = 0
            if s[key] - t[key] <= -1:
                return key


if __name__ == '__main__':

	test_case = Solution()
	s, t = [input() for _ in range(2)]
	print('\n' + test_case.findTheDifference(s, t))
## Instruction:
Refactor to remove nested for loop
## Code After:
from collections import Counter


class Solution:
    def findTheDifference(self, s, t):

        s = Counter(s)
        t = Counter(t)

        for key in t.keys():
            if s[key] != t[key]:
                return key



if __name__ == '__main__':

	test_case = Solution()
	s, t = [input() for _ in range(2)]
	print('\n' + test_case.findTheDifference(s, t))