You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 line
476B

  1. import re
  2. import sys
  3. def checks1(string):
  4. yield len(re.findall(r'([aeiou])', string)) >= 3
  5. yield len(re.findall(r'(.)\1', string))
  6. yield len(re.findall(r'(ab|cd|pq|xy)', string)) == 0
  7. def checks2(string):
  8. yield len(re.findall(r'(.)(.).*\1\2', string)) >= 1
  9. yield len(re.findall(r'(.).\1', string)) >= 1
  10. ans1 = 0
  11. ans2 = 0
  12. for line in sys.stdin.read().splitlines():
  13. ans1 += all(checks1(line))
  14. ans2 += all(checks2(line))
  15. print(ans1)
  16. print(ans2)