Question: Write a program that keeps a count of the lines in the input and prints out the line number, the number of characters in the

Write a program that keeps a count of the lines in the input and prints out the line number, the number of characters in the line followed by the line itself.

Input -- The input will be one or more lines of characters that have been typed in by the user.

Output --The output will have for each line, the line number followed by a space, followed by the number of characters in the line, followed by a space, followed by the line that was entered

Sample Input

hello there!

I am a bee

Sample Output

1 12 hello there!

2 10 I am a bee

--HINT Have a variable (say named count) that you keep incrementing by 1 every time you read a new line. Initial value should be 1. Also, use the String's length method to get the length of the line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!