#include #include #include #include #include #include #include #include #include #include using namespace std; //#define __int64 long long #define long __int64 #define REP(i,a,b) for(int i=a;i> s; int c1 = 0; int c2 = s.length() - 1; while(c1 <= c2){ if(s[c1] != s[c2]){ s2 = s; s2.insert(s2.begin() + c1, s[c2]); if(check(s2)){ cout << s2 << endl; return 0; } s2 = s; s2.insert(s2.begin() + c2, s[c1]); if(check(s2)){ cout << s2 << endl; return 0; } cout << "NA" << endl; return 0; } c1 ++; c2 --; } s.insert(s.begin() + s.length() / 2, s[s.length() / 2]); cout << s << endl; return 0; }