-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_D_j_Vu.cpp
More file actions
48 lines (47 loc) · 896 Bytes
/
A_D_j_Vu.cpp
File metadata and controls
48 lines (47 loc) · 896 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
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long int ll;
const int N = 2e3 + 100;
const int mod = 1e9 + 7;
void Accepted(){
string s;
cin>>s;
int n=s.size();
int c=count(s.begin(),s.end(),'a');
string k;
k='a';k+=s;
string ss;
ss=s;ss+='a';
if(c==n){
cout<<"NO"<<endl;
}else{
for(int i=0;i<k.size()/2;i++){
if(k[i]!=s[n-i-1]){
cout<<"YES"<<endl;
cout<<k<<endl;
return;
}
}
for(int i=0;i<ss.size();i++){
if(ss[i]!=ss[n-i-1]){
cout<<"YES"<<endl;
cout<<ss<<endl;
return;
}
}
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;cin>>t;
while(t--){
Accepted();
}
exit(0);
return 0;
}