Please post the program's output and explain what is wrong with it and show what it should be.
Type: Posts; User: Norm
Please post the program's output and explain what is wrong with it and show what it should be.
The index is past the end of the array. Remember array indexes go from 0 to the length-1
One way would be to make two passes. The first to find the longest, the second to count.
Another way would be to use parallel arrays, have one array contain the length, and the other the count.
...
Read all the strings and remember the length of the longest one, create the array then read them again and count the lengths.
Do you know how to use a Map? It would be useful: key=length of String, value=count
Otherwise use an array. What is the max String length? Have an array with a slot for each length and...