forked from shunr/competitive-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathccc03s2.py
More file actions
38 lines (34 loc) · 826 Bytes
/
ccc03s2.py
File metadata and controls
38 lines (34 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
x = int(input())
vowels = list("aeiou")
def r(a, b):
l1 = a.split()[-1]
l2 = b.split()[-1]
end1 = "aaaa"
end2 = "noooo"
found = False
for i in range(len(l1) - 1, -1, -1):
if l1[i] in vowels:
end1 = l1[i:]
found = True
break
for i in range(len(l2) - 1, -1, -1):
if l2[i] in vowels:
end2 = l2[i:]
found = True
break
if found:
return end1 == end2
else:
return l1 == l2
for i in range(x):
l = [input().lower() for j in range(4)]
if r(l[0], l[1]) and r(l[1], l[2]) and r(l[2], l[3]) :
print("perfect")
elif r(l[0], l[1]) and r(l[2], l[3]) :
print("even")
elif r(l[0], l[2]) and r(l[1], l[3]) :
print("cross")
elif r(l[0], l[3]) and r(l[1], l[2]) :
print("shell")
else:
print("free")