#K81822. Valid Xylon Binary Phrase
Valid Xylon Binary Phrase
Valid Xylon Binary Phrase
In the Xylon language, a valid phrase is defined as a binary string that can be segmented into tokens, where each token is either 1
or 110
. The empty string is also considered valid.
More formally, a binary string \( s \) is valid if and only if it can be written as:
\( s = t_1t_2\cdots t_k \)
where every token \( t_i \in \{1,\; 110\} \).
inputFormat
The input consists of a single line containing a binary string \( s \).
outputFormat
Output a single line: True
if the given string is a valid Xylon phrase, or False
otherwise.
110
True