#pragma region include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include #include #pragma endregion //#include ///////// #define REP(i, x, n) for(int i = x; i < n; ++i) #define rep(i,n) REP(i,0,n) ///////// #pragma region typedef typedef long long LL; typedef long double LD; typedef unsigned long long ULL; #pragma endregion //typedef ////定数 const int INF = (int)1e9; const LL MOD = (LL)1e9+7; const LL LINF = (LL)1e18; const double PI = acos(-1.0); const double EPS = 1e-9; ///////// using namespace::std; void solve(){ LL mod1 = 1000000000; ///123456789 LL mod2 = MOD; string str; cin >> str; const int size = str.size(); //全ての数字を使えるとき,dp[i]:=i桁の回文の個数 vector< LL > dpALL1(size+1,0); vector< LL > dpALL2(size+1,0); dpALL1[1] = 9; dpALL2[1] = 9; for(int i=2;i<=size;++i){ LL res1 = dpALL1[i-1]; LL res2 = dpALL2[i-1]; if( i&1 ){//中央に数字を加える。 res1 *= 10; res2 *= 10; }/*else{//中央の数字をコピーする }*/ dpALL1[i] = res1 % mod1; dpALL2[i] = res2 % mod2; } //1桁少ない場合 LL ans1 = 0; LL ans2 = 0; for(int i=1;i > dp1(2,vector(size,0)); vector< vector< LL > > dp2(2,vector(size,0)); LL res1,res2; const int mid = size/2 + (size&1); for(int i=0;i str[size-1-i] ){ flag1 = 0; flag2 = 0; break; } } res1 = (dp1[1][mid-1] + flag1); ans1 = (ans1 + res1) % mod1; res2 = (dp2[1][mid-1] + flag2); ans2 = (ans2 + res1) % mod2; cout << ans1 << endl; cout << ans2 << endl; } #pragma region main signed main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;//小数を10進数表示 cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別 solve(); } #pragma endregion //main()