#include using namespace std; string N; map memo; int dfs(string n) { if (memo.find(n)!=memo.end()) { return memo[n]; } if (n.size()<3) { return memo[n] = 0; } int res = 0; for (int i=0; i> N; cout << dfs(N) << endl; }