Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {string str;
  7. int a=0,b=0;
  8. char ans;
  9. getline(cin , str);
  10. for(int i=0;i<str.length();i++){
  11. b=0;
  12. for(int c=0;c<str.length();c++){
  13. if ( str[i] == str[c]){
  14. b++;}
  15. }
  16. if (b>a){
  17. ans=str[i];
  18. a=b;}
  19. }
  20. cout << ans;
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement