18 lines
536 B
Python
18 lines
536 B
Python
import sys
|
|
|
|
def isnice1(l):
|
|
if any(a+b in ['ab','cd','pq','xy'] for (a,b) in zip(l,l[1:])):
|
|
return False
|
|
vowels = sum(c in 'aeiou' for c in l)
|
|
inarow = any(a==b for (a,b) in zip(l,l[1:]))
|
|
return vowels > 2 and inarow
|
|
|
|
def isnice2(l):
|
|
xyxy = any(l[i:i+2] == l[j:j+2] for i in range(len(l)-1) for j in range(i+2,len(l)-1))
|
|
gfg = any(a == b for a,b in zip(l[0:],l[2:]))
|
|
return xyxy and gfg
|
|
|
|
isnice = isnice2 if sys.argv[1] == "2" else isnice1
|
|
|
|
print(sum(isnice(l[:-1]) for l in sys.stdin.readlines()))
|