CJCoding With Joseph
15free / daySign inCreate account

Longest Name On File

Three names read from input are written to names.txt, one per line, and the file is then read back line by line. Fill in the comparison inside the loop so longest ends up holding the longest name (when two names tie in length, keep the one that came first) and the print after the loop shows it. Input: three lines, one name each, no prompt.

Expected Output:

Giselle

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
Files
📥 Auto-Input:
Maya\nGiselle\nBo\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.