#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; bool search(string s, bool right) { string tester(s); bool filled = false; rep(i,tester.size()/2) // fill test { if (tester[i] != tester[tester.size() - 1 - i]) { if (right) { tester.insert(tester.size()-i,tester.substr(i,1)); }else { tester.insert(i,tester.substr(tester.size() - 1 - i,1)); } filled = true; break; } } if (!filled) { tester.insert(tester.size()/2,tester.substr(tester.size()/2,1)); } rep(i,tester.size()) // check { if (tester[i] != tester[tester.size() -1 - i]) { return false; } } cout << tester << endl; return true; } int main() { string s; cin >> s; if (search(s,true)) { return 0; } if (search(s,false)) { return 0; } cout << "NO" << endl; return 0; }