Advertisement
AskTomorrow

Untitled

Feb 28th, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. FirstStudentFirstGroup = input().split()
  2. SecondStudentFirstGroup = input().split()
  3. FirstStudentSecondGroup = input().split()
  4. SecondStudentSecondGroup = input().split()
  5.  
  6. FirstStudentFirstGroup.sort()
  7. FirstStudentSecondGroup.sort()
  8. SecondStudentFirstGroup.sort()
  9. SecondStudentSecondGroup.sort()
  10.  
  11. d = {}
  12.  
  13. for i in range(max(len(FirstStudentFirstGroup), len(SecondStudentFirstGroup))):
  14.     if i < len(FirstStudentFirstGroup) and i < len(SecondStudentFirstGroup):
  15.         if FirstStudentFirstGroup[i] == SecondStudentFirstGroup[i]:
  16.             d[FirstStudentFirstGroup[i]] = 1
  17.  
  18. for i in range(max(len(FirstStudentSecondGroup), len(SecondStudentSecondGroup))):
  19.     if i < len(FirstStudentSecondGroup) and i < len(SecondStudentSecondGroup):
  20.         if FirstStudentSecondGroup[i] == SecondStudentSecondGroup[i]:
  21.             d[FirstStudentSecondGroup[i]] = 1
  22.  
  23. print(list(d.keys()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement