{"problem":{"name":"Chain Contestant","description":{"content":"AtCoder in another world holds $10$ types of contests called AAC, ..., AJC. There will be $N$ contests from now on.   The types of these $N$ contests are given to you as a string $S$: if the $i$\\-th c","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc215_e"},"statements":[{"statement_type":"Markdown","content":"AtCoder in another world holds $10$ types of contests called AAC, ..., AJC. There will be $N$ contests from now on.  \nThe types of these $N$ contests are given to you as a string $S$: if the $i$\\-th character of $S$ is $x$, the $i$\\-th contest will be A$x$C.  \nAtCoDeer will choose and participate in one or more contests from the $N$ so that the following condition is satisfied.\n\n*   In the sequence of contests he will participate in, the contests of the same type are consecutive.\n    *   Formally, when AtCoDeer participates in $x$ contests and the $i$\\-th of them is of type $T_i$, for every triple of integers $(i,j,k)$ such that $1 \\le i < j < k \\le x$, $T_i=T_j$ must hold if $T_i=T_k$.\n\nFind the number of ways for AtCoDeer to choose contests to participate in, modulo $998244353$.  \nTwo ways to choose contests are considered different when there is a contest $c$ such that AtCoDeer participates in $c$ in one way but not in the other.\n\n## Constraints\n\n*   $1 \\le N \\le 1000$\n*   $|S|=N$\n*   $S$ consists of uppercase English letters from `A` through `J`.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$S$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc215_e","tags":[],"sample_group":[["4\nBGBH","13\n\nFor example, participating in the $1$\\-st and $3$\\-rd contests is valid, and so is participating in the $2$\\-nd and $4$\\-th contests.  \nOn the other hand, participating in the $1$\\-st, $2$\\-nd, $3$\\-rd, and $4$\\-th contests is invalid, since the participations in ABCs are not consecutive, violating the condition for the triple $(i,j,k)=(1,2,3)$.  \nAdditionally, it is not allowed to participate in zero contests.  \nIn total, there are $13$ valid ways to participate in some contests."],["100\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBIEIJEIJIJCGCCFGIEBIHFCGFBFAEJIEJAJJHHEBBBJJJGJJJCCCBAAADCEHIIFEHHBGF","330219020\n\nBe sure to find the count modulo $998244353$."]],"created_at":"2026-03-03 11:01:13"}}