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];
- cin.get(s,101);
- int v[26],V[26];
- for(int i=0; i<=26; i++)
- {
- v[i]=0;
- V[i]=0;
- }
- for(int i=0; i<strlen(s); i++)
- {
- if(s[i]!=' ')
- {
- if(s[i]>='a' && s[i]<='z')
- {
- v[s[i]-'a']++;
- }
- else
- {
- V[s[i]-'A']++;
- }
- }
- }
- char chr;
- int mx=-1;
- for(int i=0; i<=26; i++)
- {
- if(v[i]>mx)
- {
- mx=v[i];
- }
- if(V[i]>mx)
- {
- mx=V[i];
- }
- }
- for(int i=0; i<=26; i++)
- {
- if(v[i]==mx)
- {
- cout<<(char)(i+'a');
- }
- else
- {
- if(V[i]==mx)
- {
- cout<<(char)(i+'A');
- }
- }
- }
- cout<<" "<<mx;
- return 0;
- }
- //Voi da Bacalaureatul la Informatica
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement