-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_D_j_Vu.cpp
50 lines (42 loc) · 811 Bytes
/
A_D_j_Vu.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
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
int main()
{
int t;
cin >> t;
while (t--)
{
string s;
cin >> s;
int f = 1;
for (int i = 0; i < s.size(); i++)
{
if (s[i] != 'a')
{
f = 0;
break;
}
}
if (f == 1)
{
cout << "NO\n";
}
else
{
cout << "YES\n";
string s1 = s + 'a';
string s1rev = s1;
reverse(s1rev.begin(), s1rev.end());
if (s1 == s1rev)
{
cout << 'a' + s << "\n";
}
else
{
cout << s + 'a' << "\n";
}
}
}
}