Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
536 B
0
Indexable
Never
#include <iostream>
using namespace std;

int main()
{
    string number;
    cin >> number;
    int g = 1, max = 0, a=0, i;
    for (i =0; i < number.length(); i++)
    {
        
        if (number[i] == number[i+1])
        {
            g++;
            a++;
            if (g > max)
            {
                max = g;
            }
        }
        
        if (number[i] != number[i+1])
        {
            g = 0;
        }
    }
    
    if (a ==0)
    {
        cout << a;
    }
    else
        cout << max+1 << endl;
}