#include<vector>
#include<iostream>
#include<queue>
using namespace std;
class Solution {
public:
vector<string> path_;
vector<vector<string>> res_;
vector<vector<string>> partition(string s) {
bt(s, 0);
return res_;
}
void bt(const string& s, int start_idx) {
if (start_idx >= s.size()) {
res_.push_back(path_);
return;
}
for (int i = start_idx; i < s.size(); i++) {
string sub_s = s.substr(start_idx, i - start_idx + 1);
if (valid(sub_s)) {
path_.push_back(sub_s);
bt(s, i + 1);
path_.pop_back();
}
}
}
bool valid(const string& str) {
if (str.size() == 1) {
return true;
}
int s = 0;
int e = str.size() - 1;
while(s < e) {
if (str[s++] != str[e--]) {
return false;
}
}
return true;
}
};
int main() {
Solution s;
auto res = s.partition("aab");
for (auto vs : res) {
for (auto s: vs) {
std::cout<<s<<" ";
}
std::cout<<endl;
}
}
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
vector<string> path_;
vector<vector<string>> res_;
int f(int num) {
string num_str = to_string(num);
bt(num_str, 0);
return res_.size();
}
void bt(const string& num_str, int start_idx){
if (start_idx >= num_str.size()) {
res_.push_back(path_);
return;
}
for (int i = start_idx; i < num_str.size(); i++) {
auto sub_str = num_str.substr(start_idx, i - start_idx + 1);
if (sub_str.size() <=2 && stoi(sub_str) <=26 && stoi(sub_str) >=0) {
path_.push_back(sub_str);
bt(num_str, i + 1);
path_.pop_back();
}
}
}
};
int main() {
Solution s;
int a, b;
while (cin >> a) {
cout << s.f(a) << endl;
}
}