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,cnt;
- cin.getline(s,101);
- //gasesc frecventa maxima pt o litera
- for(char ch='a';ch<='z';ch++){
- cnt=0;
- for(int i=0;i<strlen(s);i++){
- if(ch==s[i]) cnt++;
- }
- if(cnt>maxx) maxx=cnt;
- }
- for(char ch='A';ch<='Z';ch++){
- cnt=0;
- for(int i=0;i<strlen(s);i++){
- if(ch==s[i]) cnt++;
- }
- if(cnt>maxx) maxx=cnt;
- }
- cout<<maxx<<endl;
- //afisez literele cu frecventa maxima
- for(char ch='a';ch<='z';ch++){
- cnt=0;
- for(int i=0;i<strlen(s);i++){
- if(ch==s[i]) cnt++;
- }
- if(cnt==maxx) cout<<ch;
- }
- for(char ch='A';ch<='Z';ch++){
- cnt=0;
- for(int i=0;i<strlen(s);i++){
- if(ch==s[i]) cnt++;
- }
- if(cnt==maxx) cout<<ch;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement