CF1129C Morse Code
题目描述
在摩尔斯电码(以下简称“摩码”)中,字母表中的一个字母被表示为一个长度为$1$~$4$的01串。长度为$1$~$4$的01串共有$2^1+2^2+2^3+2^4=30$个,而字母只有$26$个,所以有$4$个01串不表示任何字母——"0011"、"0101"、"1110"、"1111",其他$26$个01串表示互不相同的$26$个字母。
你有一个01串$S$,初始为空。现在有$m$次添加,每次往$S$的末尾添加一个字符("0"或"1")。对于每一次添加,你都要回答目前的$S$的所有非空子串用摩码所能表示的字母串的总数。由于答案可能巨大,你只需要输出答案模$10^9+7$的结果。
输入格式
第$1$行:一个整数$m$——添加的次数。
第$2$~$m+1$行:一个整数,$0$或$1$——每次添加的字符。
输出格式
$m$行:每一次添加之后的答案。
说明/提示
Let us consider the first sample after all characters have been appended to $ S $ , so S is "111".
As you can see, "1", "11", and "111" all correspond to some distinct English letter. In fact, they are translated into a 'T', an 'M', and an 'O', respectively. All non-empty sequences of English letters that are represented with some substring of $ S $ in Morse code, therefore, are as follows.
1. "T" (translates into "1")
2. "M" (translates into "11")
3. "O" (translates into "111")
4. "TT" (translates into "11")
5. "TM" (translates into "111")
6. "MT" (translates into "111")
7. "TTT" (translates into "111")
Although unnecessary for this task, a conversion table from English alphabets into Morse code can be found [here](https://en.wikipedia.org/wiki/Morse_code).