#include <cstdio>
#include <vector>
#include <string>
#include <cctype>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int MAX = 128 << 2;
int dp[MAX];
char rp[MAX >> 2][6] =
{
"4", "|3", "(", "|)", "3", "|=", "6", "#", "|",
"_|", "|<", "|_", "|\\/|", "|\\|", "0", "|0",
"(,)", "|?", "5", "7", "|_|", "\\/", "\\/\\/",
"><", "-/", "2"
};
int main()
{
char buffer[MAX];
char s[MAX];
while (cin >> buffer && buffer[0] != 'e')
{
s[0] = '\0';
int len = strlen(buffer);
for (int i = 0; i < len; ++i)
{
strcat(s, rp[buffer[i] - 'A']);
}
len = strlen(s);
memset(dp, 0, sizeof(dp));
for (int i = 0; i < len; ++i)
{
char ch = s[i + 1];
s[i + 1] = '\0';
for (int t = 0; t < 26; ++t)
{
if (strcmp(rp[t], s) == 0)
{
++dp[i];
break;
}
}
for (int j = 1; j <= i; ++j)
{
for (int t = 0; t < 26; ++t)
{
if (strcmp(rp[t], s + j) == 0)
{
dp[i] += dp[j - 1];
}
}
}
s[i + 1] = ch;
}
cout << dp[len - 1] << endl;
}
return 0;
}