2023-12-02 21:35:11 -08:00
|
|
|
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
ios::sync_with_stdio(0);
|
|
|
|
cin.tie(0);
|
|
|
|
|
|
|
|
int ret = 0, id = 0, r = 0, g = 0, b = 0;
|
|
|
|
|
2023-12-03 16:15:40 -08:00
|
|
|
while (!cin.eof()) {
|
|
|
|
switch (cin.get()) {
|
2023-12-02 21:35:11 -08:00
|
|
|
case 'G':
|
2023-12-03 16:15:40 -08:00
|
|
|
cin.ignore(4);
|
2023-12-02 21:35:11 -08:00
|
|
|
cin >> id;
|
|
|
|
break;
|
|
|
|
case ':': case ',': case ';':
|
2023-12-03 16:15:40 -08:00
|
|
|
cin.ignore(1);
|
2023-12-02 21:35:11 -08:00
|
|
|
int n;
|
|
|
|
cin >> n;
|
2023-12-03 16:15:40 -08:00
|
|
|
cin.ignore(1);
|
|
|
|
switch (cin.get()) {
|
2023-12-02 21:35:11 -08:00
|
|
|
case 'r': r = max(n, r); break;
|
|
|
|
case 'g': g = max(n, g); break;
|
|
|
|
case 'b': b = max(n, b); break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case '\n':
|
|
|
|
ret += r * g * b;
|
|
|
|
r = 0; g = 0; b = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << ret << '\n';
|
|
|
|
}
|