#include #include #include using namespace std; string translations[26] = { "4", "|3", "(", "|)", "3", "|=", "6", "#", "|", "_|", "|<", "|_", "|\\/|", "|\\|", "0", "|0", "(,)", "|?", "5", "7", "|_|", "\\/", "\\/\\/", "><", "-/", "2" }; int main(){ while (true){ string s; getline (cin, s); if (s == "end") break; string t; for (int i = 0; i < s.length(); i++) t += translations[(int)(s[i] - 'A')]; vector num_parses (t.length()+1); num_parses[0] = 1; for (int i = 1; i <= t.length(); i++){ for (int j = 0; j < 26; j++){ int L = translations[j].length(); if (i >= L && translations[j] == t.substr (i-L,L)){ num_parses[i] += num_parses[i-L]; } } } cout << num_parses[t.length()] << endl; } }