-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSPCS.cpp
More file actions
41 lines (40 loc) · 834 Bytes
/
SPCS.cpp
File metadata and controls
41 lines (40 loc) · 834 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
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
int main(){
int t,l,i,flag;
char a[100010],b;
scanf("%d",&t);
vector<char> v;
while(t--){
flag = 0;
v.clear();
scanf("%s",a);
l = strlen(a);
b = a[0];
i = 1;
v.push_back(b);
while(i < l){
if (b == a[i]){
i++;
}
else{
b = a[i];
i++;
v.push_back(b);
}
}
l = v.size();
for(i = 0; i < l / 2; i++){
if (v[i] != v[l - i - 1]){
cout<<"NO"<<endl;
flag = 1;
break;
}
}
if(flag == 0)
cout<<"YES"<<endl;
}
}