Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
82069 石晋骁 统计字符数量 C++ Accepted 1 MS 276 KB 334 2024-07-12 17:01:17

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; char s[1000000]; int main(){ cin >> s; int sn[150]={0}; int sl = strlen(s); for(int i = 0;i < sl;i++){ sn[ s[i] ]++; } int max=0,k; for(int j ='a';j <= 'z';j++){ if(max<sn[j]){ max = sn[j]; k = j; } } cout << char(k) << " " << max; return 0; }