#include using namespace std; using ll = long long; using pll = pair; #define drep(i, cc, n) for (int i = (cc); i <= (n); ++i) #define rep(i, n) drep(i, 0, n - 1) #define all(a) (a).begin(), (a).end() #define pb push_back #define fi first #define se second const ll MOD = 1000000007; const ll MOD2 = 998244353; const ll INF = 1LL << 60; const ll MAX_N = 2e5; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); string s; cin >> s; ll n = (ll)s.size(); ll ans_len = INF; string ans_str = ""; for(ll i=0; i=0; k--) pre+=s[k]; bool check2 = true; if((ll)pre.size() < (ll)post.size()) continue; for(ll k=0; k<(ll)post.size(); k++){ if(pre[k]!=post[k]){ check2 = false; } } if(check1 && check2){ string tmp = s; for(ll k=i-1-(ll)post.size(); k>=0; k--) tmp+=s[k]; if((ll)tmp.size() < ans_len){ ans_len = (ll)tmp.size(); ans_str = tmp; } } } cout << ans_str << endl; }