Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <map>
- #include <set>
- #include <algorithm>
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false);
- string s;
- cin >> s;
- int n = (int) s.size();
- if(n <= 1000) {
- int res = 0;
- for(int i = 0; i < n; i++) {
- string tmp = "";
- for(int j = i; j < n; j++) {
- tmp += s[j];
- string rev_tmp = tmp;
- reverse(rev_tmp.begin(), rev_tmp.end());
- string x = tmp + rev_tmp + tmp + rev_tmp;
- if(s.find(x) != string::npos) {
- res = max(res, (int) x.size());
- }
- }
- }
- cout << res << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement