fork download
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<vector>
  4. #include<string>
  5. #include <cmath>
  6. #include <utility>
  7. #include <unordered_map>
  8. #include <unordered_set>
  9. #include <map>
  10. #include <cstdint>
  11. #include <iomanip> // Required for std::fixed and std::setprecision
  12. #include<limits>
  13. #include <climits>
  14. using namespace std;
  15.  
  16. // #include <ext/pb_ds/assoc_container.hpp>
  17. // #include <ext/pb_ds/tree_policy.hpp>
  18. // using namespace __gnu_pbds;
  19.  
  20. // #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
  21. #define int long long
  22.  
  23. // #define setbits(x) __builtin_popcountll((int)x)
  24. #define result(ans) cout<<(ans?"YES":"NO")<<endl;
  25. #define debug cout<<"Chal rha hai be "<<endl;
  26. #define vi vector<int>
  27. #define vs vector<str>
  28. #define vc vector<char>
  29. #define MOD 1000000007
  30. #define vvi vector<vector<int> >
  31. #define pii pair<int,int>
  32. #define vpi vector<pair<int,int> >
  33. #define ff first
  34. #define ss second
  35. #define mii map<int,int>
  36. #define printv(v) for(int i=0;i<v.size();i++) cout<<v[i]<<" \n"[i==v.size()-1];
  37. #define scanv(v) for(auto &i:v) {cin>>i;}
  38. #define pb push_back
  39. // #define scantree(v) for(int i=0;i<v.size()-1;i++){int x,y;cin>>x>>y;x--;y--;v[x].pb(y);v[y].pb(x);}
  40. #define all(v) v.begin(),v.end()
  41. #define loop(a,b,c) for(int i=a;i<b;i+=c)
  42. #define MAX 10000
  43. #define max3(a,b,c) max(a,max(b,c))
  44. #define max4(a,b,c,d) max(a,max(b,max(c,d)))
  45. #define mp make_pair
  46.  
  47. vector<int> prefixSum(const vector<int>& arr) {
  48. int n = arr.size();
  49. vector<int> prefixSums(n);
  50. if (n == 0) return prefixSums;
  51. prefixSums[0] = arr[0];
  52. for (int i = 1; i < n; i++) {
  53. prefixSums[i] = prefixSums[i - 1] + arr[i];
  54. }
  55. return prefixSums;
  56. }
  57.  
  58.  
  59.  
  60. // instead of log2
  61. int log(long long x)
  62. {
  63. return 64 - __builtin_clzll(x) - 1;
  64. }
  65. int maxv(vi v){
  66. int ans=INT_MIN;
  67. for(int i=0;i<v.size();i++){
  68. ans=max(ans,v[i]);
  69. }
  70. return ans;
  71. }
  72. int minv(vi v){
  73. int ans=INT_MAX;
  74. for(int i=0;i<v.size();i++){
  75. ans=min(ans,v[i]);
  76. }
  77. return ans;
  78. }
  79. int fact(int n)
  80. {
  81. if(n==0) return 1;
  82. int res = 1;
  83. for (int i = 2; i <= n; i++)
  84. res = res * i;
  85. return res;
  86. }
  87. int ncr(int n, int r){return fact(n) / (fact(r) * fact(n - r));}
  88. int npr(int n, int r){return fact(n) / fact(n - r);}
  89.  
  90. int isSorted(vector<int>v){
  91. for(int i=0; i<v.size()-1; i++){
  92. if (v[i]>v[i+1]) return 0;
  93. }
  94. return 1;
  95. }
  96. int gcd(int a, int b) {
  97. return b == 0 ? a : gcd(b, a % b);
  98. }
  99. int isSubstr(string S1, string S2){
  100. int M = S1.length();
  101. int N = S2.length();
  102. for (int i = 0; i <= N - M; i++) {
  103. int j;
  104. for (j = 0; j < M; j++) {
  105. if (S2[i + j] != S1[j]) {
  106. break;
  107. }
  108. }
  109. if (j == M) {
  110. return i;
  111. }
  112. }
  113. return -1;
  114. }
  115. int freqi(vector<int>a,int b,int c){
  116. int count =0;
  117. for(int i=c+1; i<a.size();i++){
  118. if(a[i]==b){count++;}
  119. }
  120. if(count){return count;}
  121. else {return -1;}
  122. }
  123. int freqs(string a,char b){
  124. int count =0;
  125. for(int i=0; i<a.length();i++){
  126. if(a[i]==b){count++;}}
  127. if(count){return count;}
  128. else {return -1;}
  129. }
  130. int lcm(int a,int b){
  131. return (a*b)/gcd(a,b);
  132. }
  133. bool sortcol(const vector<int>& v1, const vector<int>& v2)
  134. {
  135. return v1[1] < v2[1];
  136. }
  137. bool c(pair<int,int>p1 , pair<int,int>p2){
  138. if(p1.first == p2.first){
  139. return p1.second < p2.second;
  140. }
  141. return p1.first > p2.first;
  142. }
  143. bool isPrime(int n) {
  144. if (n <= 1) return false;
  145. if (n <= 3) return true;
  146. if (n % 2 == 0 || n % 3 == 0) return false;
  147. for (int i = 5; i * i <= n; i += 6) {
  148. if (n % i == 0 || n % (i + 2) == 0)
  149. return false;
  150. }
  151. return true;
  152. }
  153. pair<int ,int> smallestPrimeGreaterThan(int num){
  154. int candidate = num;
  155. int count = 0;
  156. while (!isPrime(candidate)){candidate++;count++;}
  157. pair<int ,int > x;
  158. x.first = candidate;
  159. x.second = count;
  160. return x;}
  161. vector<int> getFactors(int n) {
  162. vector<int> factors;
  163.  
  164. // Loop up to the square root of n
  165. for (int i = 2; i <= sqrt(n); ++i) {
  166. if (n % i == 0) {
  167. factors.push_back(i); // Add the factor
  168. if (i != n / i) { // Avoid adding the square root twice
  169. factors.push_back(n / i);
  170. }
  171. }
  172. }
  173. // factors.pb(n);
  174. // Sort factors in ascending order
  175. // sort(factors.begin(), factors.end());
  176. return factors;
  177. }
  178.  
  179.  
  180. vector<bool> sieveOfEratosthenes(int n) {
  181. // Create a boolean vector initialized to true
  182. vector<bool> is_prime(n + 1, true);
  183.  
  184. // Mark 0 and 1 as non-prime
  185. if (n >= 0) is_prime[0] = false;
  186. if (n >= 1) is_prime[1] = false;
  187.  
  188. // Start the Sieve of Eratosthenes algorithm
  189. for (int i = 2; i * i <= n; i++) {
  190. if (is_prime[i]) {
  191. for (int j = i * i; j <= n; j += i) {
  192. is_prime[j] = false;
  193. }
  194. }
  195. }
  196.  
  197. return is_prime;
  198. }
  199.  
  200.  
  201. bool vp_desc(const pair<int, int>& p1, const pair<int, int>& p2) {
  202. return p1.second > p2.second;
  203. }
  204. int findSubstring(const string& mainStr, const string& subStr) {
  205. size_t pos = mainStr.find(subStr);
  206. if (pos != string::npos) {return pos;}
  207. else{return -1; }
  208. }
  209. int powerof2(int n) {
  210. return __builtin_ctz(n);
  211. }
  212. vector<pair<int, int> > getFrequency(const vector<int>& nums) {
  213. unordered_map<int, int> freqMap;
  214. for (int num : nums) {
  215. freqMap[num]++;
  216. }
  217.  
  218. vector<pair<int, int> > freqVector;
  219. for (const auto& entry : freqMap) {
  220. freqVector.emplace_back(entry.first, entry.second);
  221. }
  222.  
  223. sort(freqVector.begin(), freqVector.end());
  224. return freqVector;
  225. }
  226. int findGCD(const vector<int>& nums) {
  227. int gcd1 = nums[0];
  228. for (size_t i = 1; i < nums.size(); ++i) {
  229. gcd1 = gcd(gcd1, nums[i]);
  230. if (gcd1 == 1) {
  231. return 1;
  232. }
  233. }
  234. return gcd1;
  235. }
  236. bool compareBySecond(const pair<int, int>& a, const pair<int, int>& b) {
  237. return a.second < b.second; // Ascending order by second element
  238. }
  239. int fact_modulo(int n, int mod) {
  240. int result = 1;
  241. for (int i = 1; i <= n; i++) {
  242. result = (result * i) % mod;
  243. }
  244. return result;
  245. }
  246.  
  247. int sumv(vi v){
  248. int sum=0;
  249. for(auto e:v){
  250. sum+=e;
  251. }
  252. return sum;
  253. }
  254. vector<pair<int, int> > PrimeFactorsfreq(int n) {
  255. vector<pair<int, int> > primeFactors;
  256. int count = 0;
  257. while (n % 2 == 0) {
  258. count++;
  259. n /= 2;
  260. }
  261. if (count > 0 && 2 != n) {
  262. primeFactors.emplace_back(2, count);
  263. }
  264. for (int i = 3; i * i <= n; i += 2) {
  265. count = 0;
  266. while (n % i == 0) {
  267. count++;
  268. n /= i;
  269. }
  270. if (count > 0 && i != n) {
  271. primeFactors.emplace_back(i, count);
  272. }
  273. }
  274. if (n > 2) {
  275. primeFactors.emplace_back(n, 1);
  276. }
  277. return primeFactors;
  278. }
  279. vi dp;
  280. int ans = 0;
  281. void count(string s ,int n){
  282. //
  283. if(n==0) {ans++;return;};
  284. if(n<0){return;}
  285. if(s[n-1]!='0') {count(s,n-1);}
  286. // if(((s[n-3]-'0')*10 + (s[n-2]-'0'))<=26 && n>=3){
  287. // count(s,n-3);
  288. // // cout<<((s[n-3]-'0')*10 + (s[n-2]-'0'))<<endl;
  289. // }
  290. if(((s[n-2]-'0')*10 + (s[n-1]-'0'))<=26 && n>=2 && s[n-2]!='0'){
  291. count(s,n-2);
  292. // cout<<((s[n-3]-'0')*10 + (s[n-2]-'0'))<<endl;
  293. }
  294.  
  295. }
  296.  
  297. void solve(){
  298. string s;
  299. cin>>s;
  300.  
  301. // int ans = 0;
  302. // if(s.length()==0){cout<<endl;return;}
  303. count(s,s.length());
  304. cout<<ans<<endl;
  305. }
  306. int32_t main(){
  307. // #ifndef ONLINE_JUDGE
  308. // freopen("input.txt","r",stdin);
  309. // freopen("output.txt","w",stdout);
  310. // #endif
  311. std::ios::sync_with_stdio(false);
  312. std::cin.tie(nullptr);
  313. int t=1;
  314. // cin >> t;
  315. while (t--){
  316. solve();
  317. }
  318.  
  319.  
  320. return 0;
  321. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
1