0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 02:18:51 +00:00
OI-codes/Luogu/P1597/P1597.cpp

74 lines
2.0 KiB
C++
Raw Normal View History

// https://www.luogu.com.cn/record/38654562
2021-11-19 09:01:13 +00:00
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
string s;
a = b = c = 0;
cin >> s;
2021-11-19 09:01:13 +00:00
for (int i = 0; i < s.size(); i += 5) {
cout << s[i] << ' ' << s[i + 3] << ' ';
switch (s[i]) {
case 'a':
2021-11-19 09:01:13 +00:00
if ('0' <= s[i + 3] && s[i + 3] <= '9') {
a = s[i + 3] - '0';
} else {
2021-11-19 09:01:13 +00:00
switch (s[i + 3]) {
case 'a':
a = a;
break;
case 'b':
a = b;
break;
case 'c':
a = c;
break;
}
}
break;
case 'b':
2021-11-19 09:01:13 +00:00
if ('0' <= s[i + 3] && s[i + 3] <= '9') {
b = s[i + 3] - '0';
} else {
2021-11-19 09:01:13 +00:00
switch (s[i + 3]) {
case 'a':
b = a;
break;
case 'b':
b = b;
break;
case 'c':
b = c;
break;
}
}
break;
case 'c':
2021-11-19 09:01:13 +00:00
if ('0' <= s[i + 3] && s[i + 3] <= '9') {
c = s[i + 3] - '0';
} else {
2021-11-19 09:01:13 +00:00
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;
}