标签:cto style getline mat cstring line vector get cin
https://pintia.cn/problem-sets/1218774283169423360/problems/1218774532776648715
#include <cstdio> #include <iostream> #include <algorithm> #include <string> #include <cstring> #include<cmath> #include<vector> using namespace std; string a; int m = 0; int solve1(int l, int r) { for(;l >= 0 && r < a.size() && a[l] == a[r];l--,r++){} return r - 1 - (l + 1) + 1; } int solve2(int l, int r) { for(;l >= 0 && r < a.size() && a[l] == a[r];l--,r++){} return r - 1 - (l + 1) + 1; } int main() { getline(cin, a); for (int i = 0; i < a.size(); m = max(solve2(i,i + 1),max(solve1(i,i), m)),i++){} cout << m << endl; }
标签:cto style getline mat cstring line vector get cin
原文地址:https://www.cnblogs.com/hulian425/p/14029334.html