#K12426. Shortest Book Title Finder
Shortest Book Title Finder
Shortest Book Title Finder
You are given a list of book titles. Your task is to find the shortest title in the list. If there are multiple titles with the same minimum length, return the one that appears first in the list. If the list is empty, output an empty string.
Note: The length of a title is simply the number of characters in it.
The solution should read input from stdin
and output the result to stdout
.
Example:
Input: 5 The Great Gatsby A Tale of Two Cities Ulysses Don Quixote It</p>Output: It
inputFormat
The first line of the input contains a single integer N which indicates the number of book titles. The following N lines each contain a book title (a non-empty string). If N is zero, there are no book titles.
outputFormat
Output a single line which is the shortest book title. In case of ties, output the title that appears first in the input. If no titles are provided (i.e., N is 0), output an empty string.
## sample5
The Great Gatsby
A Tale of Two Cities
Ulysses
Don Quixote
It
It