Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- using ld = long double;
- string ltr(26, 'A');
- vector<string> als;
- void solve(string x, string ax, ll i)
- {
- if (x.size() == ax.size())
- {
- als.push_back(ax);
- return;
- }
- if (x.at(i) == '_')
- {
- solve(x, ax + 'C', i + 1);
- solve(x, ax + 'V', i + 1);
- solve(x, ax + 'L', i + 1);
- }
- else
- {
- solve(x, ax + x.at(i), i + 1);
- }
- }
- int main()
- {
- ll fs = 0;
- string x;
- cin >> x;
- string vcl{"AEIOU"};
- vector<ll> ex(x.size());
- ll i = 0;
- for (auto &cl : x)
- {
- if (cl != '_' && cl != 'L')
- {
- if (vcl.find(cl) != string::npos)
- {
- cl = 'V';
- }
- else
- {
- cl = 'C';
- }
- }
- else
- {
- if (cl != 'L')
- {
- ex.at(i) = 1;
- }
- }
- i += 1;
- }
- string ax;
- solve(x, ax, 0);
- for (auto cl : als)
- {
- bool r1 = true, r2 = true;
- ll c = 0;
- ll v = 0;
- for (auto c1 : cl)
- {
- if (c1 == 'V')
- {
- v += 1;
- c = 0;
- }
- else
- {
- v = 0;
- c += 1;
- }
- if (c == 3 || v == 3)
- {
- r1 = false;
- break;
- }
- }
- if (cl.find('L') == string::npos)
- {
- r2 = false;
- }
- if (r1 && r2)
- {
- ll as = 1;
- ll i = 0;
- for (auto c1 : cl)
- {
- if (ex.at(i) == 1)
- {
- if (c1 == 'V')
- {
- as = as * 5;
- }
- else if (c1 == 'C')
- {
- as = as * 20;
- }
- else if (c1 == 'L')
- {
- as *= 1;
- }
- }
- i += 1;
- }
- fs += as;
- }
- }
- cout << fs << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment