-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcorrect_sentence.py
More file actions
35 lines (35 loc) · 820 Bytes
/
correct_sentence.py
File metadata and controls
35 lines (35 loc) · 820 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
def correct(s):
for j in range(1,len(s)):
k = list(s[j])
if len(k) == 1:
if k[0] in A or k[0] in B:
continue
else:
print("NO")
return
elif k[0] in A:
for l in range(1,len(k)):
if k[l] not in A:
print("NO")
return
elif k[0] in B:
for l in range(1,len(k)):
if k[l] not in B:
print("NO")
return
else:
print("NO")
return
print("YES")
return
A = []
B = []
for a in range(97,110):
A.append(chr(a))
for b in range(78,91):
B.append(chr(b))
# print(A, B)
t = int(input())
for i in range(0,t):
S = list(input().split())
correct(S)