its because scanner class reach to end when counting the letter. It will return 0 for other two.
1) You can solve this by making a string. and pass that string to scanner
2) make a custom class which has three variable count, total count and length. and make function accordingly and check all of three variable in a function.
Majestics
Practically a Master Poster
696 posts since Jul 2007
Reputation Points: 209
Solved Threads: 66
Skill Endorsements: 5