#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; bool is_palindrome(string S) { for( int i = 0, j = S.length()-1; i < j; i++, j-- ) { if( S[i] != S[j] ) { return false; } } return true; } int main() { cin.tie(0); ios::sync_with_stdio(false); string A; cin >> A; int N = A.length(); for( int i = 0; i <= N; i++ ) { string B = A.substr(0, i); reverse(B.begin(), B.end()); if( is_palindrome(A+B) ) { cout << A+B << endl; return 0; } } }