We can read 13576870234289
digit-by-digit in English, and it makes a haiku:
one three five seven
six eight seven zero two
three four two eight nine
We say it's a "digit haiku", because when read out like this, it's 5+7+5 syllables long, and no word is broken across a line.
For example, 111171111101111
is not a digit haiku, even though it has 17 syllables:
one one one one se-
-ven one one one one one ze-
-ro one one one one
Two-syllable digits (0
"zero" and 7
"seven") are not allowed to span the 5th-and-6th syllable positions, or the 12th-and-13th syllable positions. (Other than that, any 17-syllable digit string makes a digit haiku.)
All other digits beside 0 and 7 are one syllable long in English.
Task
Given a non-empty string of digits (or list of numbers) 0
through 9
, decide whether it forms a digit haiku.
You can assume the string does not start with
0
, and thus you're also permitted to take input as a number.You can assume the input is at most 17 digits long. However, it may be more than 17 syllables.
This is code-golf: aim to write the shortest answer, measured in bytes.
Test cases
7767677677 -> True
13576870234289 -> True
123456789012345 -> True
11111111111111111 -> True
9 -> False
9876543210 -> False
11171111101111 -> False
111171111101111 -> False
998765432101234 -> False
77777777777777777 -> False
1111111111111117
and11111111111111171
\$\endgroup\$Flatten[#~WordData~"Hyphenation"&/@IntegerName@IntegerDigits@#] &[13576870234289]
yields{"one", "three", "five", "sev", "en", "six", "eight", "sev", "en", "ze", "ro", "two", "three", "four", "two", "eight", "nine"}
. \$\endgroup\$