Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
Maybe a couple of tips will help bring it into the realm of possibility for you:
Somehow, I don't think this program ranks among the more challenging endeavors attempted in software development, so "impossible" my be just a bit of overstatement. - mfg > Assuming that a sentence consists of a sequence of words separated by single spaces and terminated by a full stop, write and implement a Java program that will read in a sentence from the keyboard and will print out each word on a separate line together with the number of letters in each word. For example: > INPUT > OUTPUT - > The sentence should be short enough to be entered on one line of input. It should be treated as a sequence of characters, which may be read in one at a time. Each character must be either a letter or a space or a full stop. The program will not start reading the characters until the sentence is terminated and the ENTER key is pressed. The first digit of the number of letters in each word should be vertically aligned and you may assume that no word will be longer than 20 characters. > I tried to get a solution myself but if you read in it as character you can't read the length of each word that is to be returned. If anybody has a solution please respond as I am in great difficulty here!! > Thanks
Replies: |
Sponsored Links
|