Problem 865
Triplicate Numbers
A triplicate number is a positive integer such that, after repeatedly removing three consecutive identical digits from it, all its digits can be removed.
For example, the integer $122555211$ is a triplicate number:
$$122{\color{red}555}211 \rightarrow 1{\color{red}222}11\rightarrow{\color{red}111}\rightarrow.$$
On the other hand, neither $663633$ nor $9990$ are triplicate numbers.
Let $T(n)$ be how many triplicate numbers are less than $10^n$.
For example, $T(6) = 261$ and $T(30) = 5576195181577716$.
Find $T(10^4)$. Give your answer modulo $998244353$.
三消数
对于任意正整数,不断地从中消除连续三个相同数字,若最终可以将其完全消除,则称之为三消数。
例如,整数$122555211$是三消数:
$$122{\color{red}555}211 \rightarrow 1{\color{red}222}11\rightarrow{\color{red}111}\rightarrow.$$
反之,$663633$和$9990$都不是三消数。
记$T(n)$为所有小于$10^n$的三消数的数量.
例如,$T(6) = 261$,$T(30) = 5576195181577716$。
求$T(10^4)$,并对$998244353$取余作为你的答案。