Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main(){
- char s[101]={};
- int v[60]={},cod,maxx=0;
- cin.getline(s,101);
- for(int i=0;i<strlen(s);i++){
- if(s[i]>='a' && s[i]<='z'){
- cod=s[i]-'a'+1;/// i=ch-'a'+1 ch='a'+i-1
- v[cod]++;
- if(v[cod]>maxx) maxx=v[cod];
- }
- if(s[i]>='A' && s[i]<='Z'){
- cod=s[i]-'A'+27;
- v[cod]++;
- if(v[cod]>maxx) maxx=v[cod];
- }
- }
- cout<<maxx<<endl;
- for(int i=1;i<=26;i++){
- if(v[i]==maxx){
- cout<<char(i+'a'-1);
- }
- }
- for(int i=27;i<=53;i++){
- if(v[i]==maxx){
- cout<<char(i+'A'-27);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement