You must tokenize a single line representing a shell-like command into its argument list, following these exact rules:
- Arguments are separated by one or more space characters (0x20), except where a space falls inside quotes.
- A single-quoted segment (starts and ends with
') is taken completely literally: no character inside it, including a backslash, is special. The segment ends at the very next'. - A double-quoted segment (starts and ends with
") is mostly literal, except for two special escape sequences: a backslash immediately followed by a double-quote character becomes one literal double-quote character, and a backslash immediately followed by another backslash character becomes one literal backslash character. A backslash followed by any other character inside double quotes (including at the position right before the closing quote, if that combination doesn't match one of the two escapes above) has no special meaning — both characters are kept exactly as-is. The segment ends at the next double-quote that was not just consumed as part of one of those two escapes. - Outside of any quotes, a backslash makes the next character literal (so it can no longer act as a space, quote, or backslash separator/delimiter); a backslash that is the very last character of the line (with nothing after it) contributes nothing and is dropped.
- Quoted and unquoted pieces may sit directly next to each other with no space between them, and are concatenated into the SAME argument (for example
ab"cd"efis one argument, and'a'"b"cis one argument). - The line is guaranteed to have every quote properly opened and later closed per the rules above; you never need to handle an unterminated quote.
Print the resulting arguments, one per line, in order. If the line contains zero arguments (for example it is empty or made up only of spaces), print nothing.
Input format
Line 1: the command line to tokenize (may be empty).
Output format
Each resulting argument on its own line, in order. Zero lines of output if there are zero arguments.
Constraints
- 0 ≤ length of the line ≤ 200
- the line consists of printable ASCII characters (0x20-0x7E) only, with quotes always properly matched as described above