#include #include #include using namespace std; typedef long long ll; ll mod = 924844033,dp[3000010] = {}; vector v,u; int main(){ string s; cin >> s; int i,n = s.size(); v.push_back(-1); for(i=0;i> st; st.push_back({(int)u.size(),1000000000}); vector r(u.size()); for(i=u.size() - 1;i>=0;i--){ while(st.back().second<=u[i]) st.pop_back(); r[i] = st.back().first; st.push_back({i,u[i]}); } dp[0] += u[0] + 1; dp[r[0] - 1] += 1; for(i=1;i