Advertisement
unknown_0711

Untitled

Oct 8th, 2022
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. public class Main
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Scanner sc= new Scanner (System.in);
  10. String s= sc.next();
  11. int n=s.length();
  12. int []f= new int[26]; for(int i=0;i<26;i++)f[i]=0;
  13. int a=0;
  14. for(int i=0;i<n;i++){
  15. f[s.charAt(i)-'a']++;
  16. a=Math.max(a, f[s.charAt(i)-'a']);
  17. }
  18. char y='a';
  19. for(int i=0;i<26;i++){
  20. if(f[i]==a){System.out.print(y); return;}
  21. y++;
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement