-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCorrect Sentence.cpp
More file actions
65 lines (53 loc) · 893 Bytes
/
Copy pathCorrect Sentence.cpp
File metadata and controls
65 lines (53 loc) · 893 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <bits/stdc++.h>
using namespace std;
const long long MOD= 1e9+7;
const int N = 1e5+10;
//int arr[N];
int main(){
int t;
cin>>t;
while(t--){
int k;
cin>>k;
int temp=k;
int len=0;
while(temp--){
string s;
cin>>s;
int n=s.length();
int fx=0;
int f=0;
if(n>1){
int check=islower(s[0]);
for(int i=1;i<n;i++){
if(check==0 && islower(s[i])==0 && s[i]-'N'>=0 && s[i]-'N'<=12)
continue;
else if(check!=0 && islower(s[i])!=0 && s[i]-'a'>=0 && s[i]-'a'<=12)
continue;
else{
f=1;
break;
}
}
if(f==1){
continue;}
else
len++;
}
else{
if(s[0]-'N'>=0 && s[0]-'N'<=12)
len++;
else if(s[0]-'a'>=0 && s[0]-'a'<=12)
len++;
else{
fx=1;
}
}
}
if(len==k)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}