#C4592. Length of the Shortest Word
Length of the Shortest Word
Length of the Shortest Word
Given a sentence, your task is to determine the length of the shortest word in that sentence. A word is defined as any sequence of non-space characters. If the input string is empty or contains only whitespace, the output should be 0.
The problem accepts input via standard input (stdin) and outputs the result via standard output (stdout). The sentence may include punctuation and digits, and they are considered as parts of words.
In mathematical terms, if the sentence is split into words \(w_1, w_2, \dots, w_n\), then you need to compute:
\(\min_{1 \leq i \leq n} |w_i|\)
inputFormat
The input consists of a single line, which is the sentence from which you are to find the length of the shortest word. The sentence may contain letters, digits, punctuation and spaces.
outputFormat
Output a single integer representing the length of the shortest word in the provided sentence. If there are no words, output 0.
## sampleThe quick brown fox jumps over the lazy dog
3