【蓝桥杯】单词分析 (BF)
一.题目描述
二.问题分析
//单词分析
#include <iostream>
using namespace std;
const int N=1e4+2;
char s[N];
int c[26]={0};
int main(int argc, const char * argv[]) {
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>s;
int max=0,i=0;
char x='a';
while(s[i]){
c[s[i++]%97]++;
}
for(int j=0;j<26;j++){
if(c[j]>max){
max=c[j];
x=j+'a';
}
}
cout<<x<<'\n';
cout<<max<<'\n';
return 0;
}
原文地址:https://blog.csdn.net/Hsianus/article/details/136555886
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!