Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- #include<cstdio>
- using namespace std;
- int main(){
- string s, aux;
- cin >> s;
- for(int i = 0; i <= s.size(); i++){
- for(char c = 'a'; c <= 'z'; c++){
- aux = s.substr(0, i);
- aux += c;
- if(i < s.size())aux += s.substr(i);
- bool pal = true;
- for(int l = 0, r = aux.size() - 1; l < r; l++, r--)if(aux[l] != aux[r])pal = false;
- if(pal){
- cout <<aux << endl;
- return 0;
- }
- }
- }
- puts("NA");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement