Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- cout << "Введите строку: " << endl;
- string s;
- cin >> s;
- s = s + " ";
- int max = 1;
- int maxAnswer = 0;
- for (int i = 1; i < s.size(); i++)
- if (s[i] == s[i - 1])
- max++;
- else {
- if (max > maxAnswer)
- maxAnswer = max;
- max = 1;
- }
- cout << maxAnswer;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement