Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
78936 杨一诺 统计字符数量 C++ Accepted 1 MS 268 KB 380 2024-06-29 14:18:28

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; char str[1000]; char e; int m[26]; int i,b; int max1,max2; int m1; int main(){ cin.getline(str,1000); while(str[i]!='\0'){ b=str[i]-97; m[b]++; i++; } max1=m[0]; m1=0; for(int f=1;f<26;f++){ max2=m[f]; if(max2>max1){ max1=max2; m1=f; } } e=m1+97; cout<<e<<' '<<m[m1]; return 0; }