Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
129757 翁思宸 统计字符数量 C++ Accepted 1 MS 276 KB 443 2025-09-05 19:03:20

Tests(10/10):


Code:

//1437 统计字符数量 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int main(){ char a[1000]; int s[26]={0},max=-1,max_i=0; cin>>a; for(int i=0;a[i]!='\0';i++){ s[a[i]-'a']++; } for(int i=0;s[i]!='\0';i++){ if(s[i]>max){ max=s[i]; max_i=i; } } cout<<char(max_i+'a')<<" "<<max; return 0; }