#C12403. Find the Length of the Shortest Word
Find the Length of the Shortest Word
Find the Length of the Shortest Word
Given a string of text, your task is to determine the length of the shortest word contained in the text.
A word is defined as a maximal contiguous sequence of alphanumeric characters and underscores (i.e. characters that match the regular expression \b\w+\b
). If the input string does not contain any word, output 0.
Note: The input is provided via standard input and the result should be written to standard output.
inputFormat
The input consists of a single line of text.
outputFormat
Output a single integer representing the length of the shortest word in the text. If no valid word is present, output 0.
## sampleHello world
5