Question: Longest Word Programming challenge description: In this challenge you need to find the longest word in a sentence. If the sentence has more than one

Longest Word

Programming challenge description:

In this challenge you need to find the longest word in a sentence. If the sentence has more than one word of the same length you should pick the one that appears first.

Input:

Your program should read lines from standard input. Each line has one or more words. Each word is separated by a space char.

Output:

Print the longest word in the sentence.

Test 1

Test InputDownload Test 1 Input

some line with text

Expected OutputDownload Test 1 Output

some

Test 2

Test InputDownload Test 2 Input

another line

Expected OutputDownload Test 2 Output

another

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!