#include #include #include #include #include #include using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(int i=0; i=0; i--) using Modint = atcoder::static_modint<998244353>; using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); string S; cin >> S; int n = S.size(); vector link(n+1, -1); vector fast(n+1, -1); for(int i=0; i dp(n+1); dp[0] = 0; for(int i=0; i vis(10, -1); vis[S[i] - '0'] = i; int h = i; while(h != -1){ if(h != -1 && vis[S[h] - '0'] == -1){ vis[S[h] - '0'] = h; } if(link[h] != -1 && vis[S[link[h]] - '0'] == -1){ vis[S[link[h]] - '0'] = link[h]; } h = fast[h]; } for(int d=0; d<10; d++) if(vis[d] != i) x -= dp[vis[d]+1]; dp[i+1] = x; } Modint ans = dp[n]; ans -= n-1; cout << ans.val() << endl; return 0; }