Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
88543 | 田苒彤 | 统计字符数量 | C++ | Accepted | 1 MS | 276 KB | 327 | 2024-08-19 11:54:42 |
#include<bits/stdc++.h> using namespace std; char s[1001]; int t[128]; int mx=-2e9; int main() { cin>>s; int n=strlen(s); for(int i=0;i<=n-1;i++){ t[s[i]]++; } char c; for(int i=97;i<=122;i++){ if(t[i]>mx){ mx=t[i]; c=i; } } cout<<c<<" "<<mx; return 0; }