fork download
  1. import sys
  2. def dellines():
  3.  
  4. for line in sys.stdin:
  5. seriescnt = 0
  6. bigcnt = 0
  7. smallcnt = 0
  8. digitcnt = 0
  9. state = 0
  10. for i in range(len(line)):
  11. ch = line[i]
  12.  
  13. if (ch >= "0") and (ch <= "9"):
  14.  
  15. if (state == 1):
  16. seriescnt += 1
  17. if (seriescnt > 2):
  18. state = 0
  19. break
  20. else:
  21. seriescnt = 1
  22.  
  23. digitcnt += 1
  24. if (digitcnt > 3):
  25. state = 0
  26. break
  27. state = 1
  28. elif (ch >= "A") and (ch <= "Z"):
  29.  
  30. if (state == 3):
  31. if (ord(lastch) == ord(ch) + 32):
  32. state = 0
  33. break
  34.  
  35. if (state == 2):
  36. seriescnt += 1
  37. if (seriescnt > 2):
  38. state = 0
  39. break
  40. else:
  41. seriescnt = 1
  42.  
  43. bigcnt += 1
  44. if (bigcnt > 3):
  45. state = 0
  46. break
  47.  
  48. lastch = ch
  49. state = 2
  50. elif (ch >= "a") and (ch <= "z"):
  51.  
  52. if (state == 2):
  53. if (ord(lastch) == ord(ch) - 32):
  54. state = 0
  55. break
  56.  
  57. if (state == 3):
  58. seriescnt += 1
  59. if (seriescnt > 2):
  60. state = 0
  61. break
  62. else:
  63. seriescnt = 1
  64.  
  65. smallcnt += 1
  66. if (smallcnt > 3):
  67. state = 0
  68. break
  69.  
  70. lastch = ch
  71. state = 3
  72.  
  73. if (state):
  74. sys.stdout.write(line)
  75.  
  76. dellines()
Success #stdin #stdout 0.02s 6936KB
stdin
a22tbf645
923tbFf4W
92rtRe7Ev
g7y3oP4ur
u8t9D03gE
a2t4TA6Kk
Lj3D2Jrs1
stdout
Lj3D2Jrs1