fork download
  1. s = [1, 1, 1, 1, 1, 2, 2, 2,]
  2. s.sort()
  3. cnt = 1
  4. l = len(s)
  5. for i in range(l-1):
  6. if i == l-2 or s[i + 1] != s[i + 2]:
  7. if s[i] == s[i + 1]:
  8. print(s[i], end=" ")
Success #stdin #stdout 0.02s 9264KB
stdin
Standard input is empty
stdout
1 2