Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Print Longest String
class Rextester { public static void main(String args[]) { String input = "Cheese Pepperoni Olives Armagggeddonh"; String [] a = input.split(" "); int maxLength = 0; String longestString = null; for (String s : a) { if (s.length() > maxLength){ maxLength = s.length(); longestString = s; } } System.out.println("Longestn string: "+ longestString); } }
run
|
edit
|
history
|
help
0
NumberBasedAlphabetsPrint
4th question
loding
How many Squares in Rectangle
Ways to form Max Heap
exp.1A
A
Loop from 5 to 15
has a
Series_4_8