Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- int main()
- {
- std::ios_base::sync_with_stdio(0);
- std::cin.tie(0);
- std::string s;
- std::cin >> s;
- std::vector<int> v;
- int qtd = 1;
- char last = '$';
- for (const char &c : s)
- {
- if (c == last)
- {
- qtd += 1;
- }
- else
- {
- v.push_back(qtd);
- qtd = 1;
- last = c;
- }
- }
- v.push_back(qtd);
- std::sort(v.rbegin(), v.rend());
- std::cout << (1LL * v[0] * v[1]) << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement