Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
77876 邓嘉瑶 统计字符数量 C++ Accepted 1 MS 272 KB 321 2024-06-15 16:47:13

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ char s[1001]; scanf("%s",s); int len=strlen(s); int t[27]={0}; for(int i=0;i<len;i++){ int x=s[i]-97; t[x]++; } int mx=0; for(int i=0;i<27;i++){ if(t[i]>t[mx]){ mx=i; } } char y=mx+97; cout<<y<<" "<<t[mx]; return 0; }