#C13158. Unique String Lengths
Unique String Lengths
Unique String Lengths
Given a list of tokens, some of which represent strings (enclosed in double quotes) and others which do not, process the input to extract all valid string tokens. A token is considered a valid string if it begins and ends with a double quote ("). For each valid string, compute its length as the number of characters between the quotes.
Your task is to remove any duplicate lengths and print the unique lengths in ascending order, separated by a space. If there are no valid string tokens, output an empty line.
Note: The input will be provided from standard input (stdin) and the output should be written to standard output (stdout).
inputFormat
The first line of input contains a single integer N, the number of tokens. The following tokens are provided on the same line separated by spaces. A token is a valid string token if it starts with a double quote (") and ends with a double quote ("). Tokens not enclosed in double quotes are not considered strings.
Example:
5
"hello" "world" "python" "world" ""
outputFormat
Output a single line containing the unique lengths of all valid string tokens sorted in ascending order, separated by a space. If there are no valid string tokens, output an empty line.
Example:
For the above input, the output should be:
0 5 6
5
"hello" "world" "python" "world" ""
0 5 6