44 lines
675 B
C++
44 lines
675 B
C++
|
#include <bits/stdc++.h>
|
||
|
using namespace std;
|
||
|
|
||
|
int main() {
|
||
|
ios::sync_with_stdio(0);
|
||
|
cin.tie(0);
|
||
|
|
||
|
auto& cin = std::cin >> noskipws;
|
||
|
|
||
|
int ret = 0, id = 0, r = 0, g = 0, b = 0;
|
||
|
|
||
|
for (;;) {
|
||
|
char c;
|
||
|
cin >> c;
|
||
|
switch (c) {
|
||
|
case 'G':
|
||
|
cin >> c; cin >> c; cin >> c; cin >> c;
|
||
|
cin >> id;
|
||
|
break;
|
||
|
case ':': case ',': case ';':
|
||
|
cin >> c;
|
||
|
int n;
|
||
|
cin >> n;
|
||
|
cin >> c;
|
||
|
cin >> c;
|
||
|
switch (c) {
|
||
|
case 'r': r = max(n, r); break;
|
||
|
case 'g': g = max(n, g); break;
|
||
|
case 'b': b = max(n, b); break;
|
||
|
}
|
||
|
break;
|
||
|
case '\n':
|
||
|
if (cin.eof())
|
||
|
goto end;
|
||
|
ret += r * g * b;
|
||
|
r = 0; g = 0; b = 0;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
end:
|
||
|
cout << ret << '\n';
|
||
|
}
|