Advertisement
Josif_tepe

Untitled

May 24th, 2024
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main()
  6. {
  7.     string s;
  8.     cin >> s;
  9.  
  10.     int i = 0;
  11.     int n = s.size();
  12.     long long res = 1;
  13.     while(i < n) {
  14.         if(s[i] == 'T' or s[i] == 't') {
  15.             res *= 3;
  16.             i += 8;
  17.         }
  18.         else if(s[i] == 'D' or s[i] == 'd') {
  19.             res *= 2;
  20.             i += 5;
  21.         }
  22.         else {
  23.             res -= 1;
  24.             i += 5;
  25.         }
  26.  
  27.     }
  28.     cout << res << endl;
  29.    
  30.    
  31.     return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement