Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- //
- #define ll long long
- #define ull unsigned long long
- #define mx 100010
- #define mod 1000000007
- #define inf INT_MAX
- #define pi acos(-1)
- #define endl '\n'
- #define pb push_back
- #define debug cout << "OK" << endl
- #define fin freopen("input", "r", stdin)
- #define Fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
- //
- int main() {
- string str;
- cin >> str;
- multimap<ll, char> m;
- multimap<ll, char>::iterator it;
- ll cnt = 1;
- for (ll i = 1; i < str.length(); i++) {
- if (str[i] == str[i - 1]) cnt++;
- else {
- m.insert({ cnt, str[i - 1] });
- cnt = 1;
- }
- }
- m.insert({ cnt, str[str.length() - 1] });
- it = m.end();
- it--;
- cout << it->second << " -> " << it->first << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement