#B. 斐波那契串(fib)

    Type: Default File IO: fib 1000ms 256MiB

斐波那契串(fib)

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

假设字符串 S0=bS_0=\tt bS1=aS_1=\tt a,且 Si=Si1Si2S_i=S_{i-1}S_{i-2}(这里是拼接运算)。不难发现 S998244353=abaababaabaabS_{998244353}=\tt abaababaabaab\dots

巡告诉你一个字符串 TT,你需要告诉巡最小的 lenlen 满足存在一个 1i10181\leq i\leq 10^{18} 满足 TTS998244353[i,i+len1]S_{998244353}[i,i+len-1] 的子序列。

输入格式

一行一个字符串表示 TT

输出格式

一行一个正整数表示答案。

样例 #1

【样例输入】

aabbaab

【样例输出】

8

样例 #2

见下发 fib2.in/ans\textit{fib2.in/ans}

该测试点满足测试点 11 的性质。

数据范围

测试点编号 nn\leq
11 500500
22 10510^5

对所有数据保证 1n1051\leq n\leq 10^5TT 只包含 ab\tt ab 两种字符。

NOIP 模拟赛(六)

Not Attended
Status
Done
Rule
OI
Problem
4
Start at
2024-8-17 7:45
End at
2024-8-17 12:15
Duration
4.5 hour(s)
Host
Partic.
18