Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
112282 刘轻松 统计字符数量 C++ Accepted 1 MS 276 KB 331 2025-03-09 11:29:33

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int a[27]; int main(){ string s; cin>>s; int len=s.size(); for(int i=0;i<=len-1;i++){ a[s[i]-96]++; } int max=0,maxid; for(int i=1;i<=26;i++){ if(max<a[i]){ max = a[i]; maxid = i; } } cout<<char(maxid+96)<<" "<<max<<endl; return 0; }