-
Notifications
You must be signed in to change notification settings - Fork 0
/
AMR12D.cpp
65 lines (64 loc) · 1.34 KB
/
AMR12D.cpp
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;
#define p pair <int,int>
#define pb push_back
#define ll long long
long long M=1e9+7;
int main()
{
int i,j,k,n,m,t,l;
char s[110];
//string d[110];
scanf ("%d",&t);
char ch;
//scanf ("%c",&ch);
while (t--)
{
cin>>s;
n=strlen(s);
if (n==1)
{
printf ("YES\n");
continue;
}
/*k=0;
for (i=0;i<n-1;i++)
{
for (j=2;j<=n-i;j++)
d[k++]=s.substr(i,j);
}
for (i=0;i<k;i++)
cout<<d[i]<<endl;
for (i=0;i<k;i++)
{
int x=d[i].length();
for (j=0;j<k;j++)
{
int y=d[j].length();
if (y!=x)
continue;
int z=x-1;
for (l=0;l<y;l++)
if (d[j][l]!=d[i][z--])
break;
if (l==y)
break;
}
if (j==k)
break;
}
*/i=0;j=n-1;
while (i<j)
{
if (s[i]!=s[j])
break;
i++;
j--;
}
if (i<j)
printf("NO\n");
else
printf("YES\n");
}
return 0;
}