https://atcoder.jp/contests/past202004-open/tasks/past202004_b
解説
https://atcoder.jp/contests/past202004-open/submissions/12894206
まずは候補者ごとに票を集計する。
cnt[i] := 候補者abcのi番目に入った票の数
次に、最も多い票数maを探す。
最後に、その最も多い票数を獲得している人を探して、答える。
0,1,2をa,b,cに最後変換する必要があるが、char('a'+i)とやると変換できる。
string S; int cnt[3]; //--------------------------------------------------------------------------------------------------- void _main() { cin >> S; fore(c, S) cnt[c - 'a']++; int ma = -1; rep(i, 0, 3) chmax(ma, cnt[i]); rep(i, 0, 3) if (ma == cnt[i]) cout << char('a' + i) << endl; }