0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-05 03:06:26 +00:00
OI-codes/Luogu/P1597/P1597.cpp
2022-06-03 07:55:57 +08:00

74 lines
2.0 KiB
C++

// https://www.luogu.com.cn/record/38654562
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
string s;
a = b = c = 0;
cin >> s;
for (int i = 0; i < s.size(); i += 5) {
cout << s[i] << ' ' << s[i + 3] << ' ';
switch (s[i]) {
case 'a':
if ('0' <= s[i + 3] && s[i + 3] <= '9') {
a = s[i + 3] - '0';
} else {
switch (s[i + 3]) {
case 'a':
a = a;
break;
case 'b':
a = b;
break;
case 'c':
a = c;
break;
}
}
break;
case 'b':
if ('0' <= s[i + 3] && s[i + 3] <= '9') {
b = s[i + 3] - '0';
} else {
switch (s[i + 3]) {
case 'a':
b = a;
break;
case 'b':
b = b;
break;
case 'c':
b = c;
break;
}
}
break;
case 'c':
if ('0' <= s[i + 3] && s[i + 3] <= '9') {
c = s[i + 3] - '0';
} else {
switch (s[i + 3]) {
case 'a':
c = a;
break;
case 'b':
c = b;
break;
case 'c':
c = c;
break;
}
}
break;
}
}
printf("%d %d %d\n", a, b, c);
return 0;
}