Advertisement
malixds_

A

Sep 12th, 2022
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. a, b = input().split()
  2. mpa = {}
  3.  
  4. for i in a:
  5. mpa[i] = 1
  6.  
  7. ans = ['0'] * len(a)
  8.  
  9. for i in range(len(a)):
  10. if a[i] == b[i]:
  11. mpa[a[i]] -= 1
  12. ans[i] = 'P'
  13. for i in range(len(a)):
  14. if ans[i] != '0':
  15. continue
  16. if b[i] not in mpa: mpa[b[i]] = 0
  17. if mpa[b[i]] > 0:
  18. ans[i] = 'S'
  19. mpa[b[i]] -= 1
  20. else:
  21. ans[i] = 'I'
  22.  
  23. print(''.join(ans))
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement