| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 159567 | 颜学俊逸 | 统计字符数量 | C++ | Accepted | 1 MS | 272 KB | 465 | 2026-09-05 15:30:26 |
#include<iostream> #include<cstring> using namespace std; char a[1005]; int cnt[26]; int main () { cin >> a; int t = strlen(a); for(int i = 0; i < t; i++) { int d = a[i] - 'a'; cnt[d]++; } // for(int j = 0;j < 26;j++){ // cout << char(j + 'a')<<" "<<cnt[j]<<endl; // } int max = 0; char c = 'a'; for(int i = 0;i < 26;i++){ if(cnt[i] > max){ max = cnt[i]; c = i + 'a'; } } cout << c << " "<< max << endl; return 0; }