CCCPaste

Untitled

#include 
using namespace std;


int main()
{
    string s;
    cin >> s;

    int i = 0;
    int n = s.size();
    long long res = 1;
    while(i < n) {
        if(s[i] == 'T' or s[i] == 't') {
            res *= 3;
            i += 8;
        }
        else if(s[i] == 'D' or s[i] == 'd') {
            res *= 2;
            i += 5;
        }
        else {
            res -= 1;
            i += 5;
        }

    }
    cout << res << endl;
    
    
    return 0;
}