Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
frequency of char
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int i=0; int max=0; char result='a'; int count[]=new int[256]; Scanner obj = new Scanner (System.in); String a=obj.nextLine(); for(i=0;i<a.length();i++) { count[a.charAt(i)]++; } for ( i = 0; i < a.length(); i++) { if (max < count[a.charAt(i)] ){ max = count[a.charAt(i)]; result = a.charAt(i); } } System.out.println(result); } }
run
|
edit
|
history
|
help
0
Strings Ops
Bank System
Three In A Row Solver
smallest number and its index(position)
1
Basic Matrix
http://stackoverflow.com/questions/23175927/how-to-clone-object-defined-by-interface
JAVA # Klavyeden Girilen cümlelerin en uzununu bulma
Hello, World!
variable1