Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
2.1 kB
1
Indexable
Never
//https://cses.fi/problemset/task/1755/
//Deque full use,TLE jodio


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define ff first
#define ss second
#define pb push_back
#define pob pop_back
#define pf push_front
#define full(x) x.begin(),x.end()
#define pi acos(-1)
typedef map<ll,ll>mp;

#define gcd(x,y) (ll)(__gcd(x,y))
#define lcm(x,y) (ll)((x/gcd(x,y))*y)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

//#define test ll tt; cin>>tt; while(tt--)
//#define endl "\n"
#define nl "\n"


#define test ll tt; cin>>tt; for(ll tc=1;tc<=tt;tc++)
#define countcase cout<<"Case "<<tc<<": "

#define vin ll n;cin>>n;vector<ll>v;rep(i,0,n){ll x; cin>>x;v.pb(x);}
#define ain ll n;cin>>n;ll a[n];rep(i,0,n){cin>>a[i];}

#define all(v) v.begin(),v.end()
//ll a[100001];
#define pw 1000000007

#define yes cout<<"YES\n"
#define no cout<<"NO\n"

void oj()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
///knight
int dr[] = {2, 2, -2, -2, 1, 1, -1, -1};
int cr[] = {1, -1, 1, -1, 2, -2, 2, -2};
///king
int kr[] = {+0, +0, +1, -1, -1, +1, -1, +1};
int kc[] = {-1, +1, +0, +0, +1, +1, -1, -1};

const ll base = 129;

const int A = 1e6 + 1;



int main()
{
    FIO
   string s,ss;cin>>s;
   ll c[100]={0};
   rep(i,0,s.size()){
   c[s[i]]++;
   }
   ll p=0;
   deque<char>d;
   rep(i,65,91){
   if(c[i]%2==0){
    rep(j,0,c[i]/2){
    d.push_front(i);
    d.push_back(i);
    }
   }
   else{
    p++;
    rep(j,0,c[i]) ss+=(i);
   }
   }
   //cout<<p<<endl;
     //  for(auto i:d) cout<<i;
char ch=ss[0];
   if(p==0) {
    for(auto i:d) cout<<i;
   }

   else if(p==1){
        ll k=d.size()/2;
   rep(i,0,ss.size()){
    d.insert(d.begin()+k,ch);
   }
   for(auto i:d) cout<<i;
   }
   else cout<<"NO SOLUTION\n";
    return 0;
}