|
|
back to boardCE what is my code problem ? #include <iostream> #include <vector> #include <math.h> #include <cstdio> #include <algorithm> #include <string> using namespace std; int main() { long long m,h = 0,i,t,l,n,f; string a,s; cin >> a; s = a; for(i = a.length()-1 ;i >= 0 ;i--) s[h] = a[i],h++; f = s.length()-2; i = 0; n = f; while(n >= 1 && m != 0) { t = n; m = 0; while(i <= n - (n / 2) - 1) { if(s[i] != s[t]) { m = 1; break; } i++; t--; } n--; i = 0; } if(m == 0) n++; for(i = 0 ;i < a.length() ;i++) cout << a[i]; for(i = n + 1 ;i < s.length() ;i++) cout << s[i]; cout << endl; return 0; } |
|
|