Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {string str;
- int a=0,b=0;
- char ans;
- getline(cin , str);
- for(int i=0;i<str.length();i++){
- b=0;
- for(int c=0;c<str.length();c++){
- if ( str[i] == str[c]){
- b++;}
- }
- if (b>a){
- ans=str[i];
- a=b;}
- }
- cout << ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement