-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcorrectsentence.cpp
More file actions
69 lines (68 loc) · 1.21 KB
/
correctsentence.cpp
File metadata and controls
69 lines (68 loc) · 1.21 KB
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
66
67
68
69
#include <iostream>
#include<vector>
#include<cstring>
using namespace std;
int main() {
int t,k,len,flag=1,j;
cin>>t;
while(t--)
{
flag=1;
cin>>k;
char v[k][10];
for(int i=0;i<k;i++)
{
cin>>v[i];
}
for(int i=0;i<k;i++)
{
if(flag)
{
j=0;
len = strlen(v[i]);
if(v[i][j]>=97&&v[i][j]<=109)
{
for(int l=1;l<len;l++)
{
if(flag)
{
if(v[i][l]>=97&&v[i][l]<=109)
{
flag=1;
}
else
{
flag=0;
break;
}
}
}
}
else if(v[i][j]>=78&&v[i][j]<=91)
{
for(int l=1;l<len;l++)
{
if(flag)
{
if(v[i][l]>=78&&v[i][l]<=91)
{
flag=1;
}
else
flag=0;
}
}
}
else
flag=0;
}
else
break;
}
if(flag==1)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}