#include #include using namespace std; int main() { string s; cin >> s; int firstA[200005],secondA[200005]; int firstB[200005],secondB[200005]; int a = 0,b=0; for(int i=0;i=b) { if(firstA[a-b] == -1)firstA[a-b]=i; else secondA[a-b] = i; } else { if(firstB[b-a] == -1)firstB[b-a]=i; else secondA[b-a] = i; } } int ans = 0; for(int i=0;i