```cpp
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin >> a >> b >> c;
if(a>c) swap(a,c);
if(a>b) swap(a,b);
if(b>c) swap(b,c);
//上面3个交换代码就是讲a,b,c从小到大排序
for(int i=1;i<=3;i++){
char chn;
cin >> chn;//输入ABC顺序
if(chn=='A') cout<<a<<' ';//如果是A,输出a的值
else if(chn=='B') cout<<b<<' ';//如上
else if(chn=='C') cout<<c<<' ';//如上
}
return 0;
}
```
我觉得我的代码虽然不是最短,但也比较简洁明了,希望能帮到你
by czxuyang @ 2024-01-27 12:36:06
我就不说废话了
```cpp
#include<bits/stdc++.h>
using namespace std;
int main() {
int a[3];//数组
cin>>a[0]>>a[1]>>a[2];//输入
sort(a,a+3);//排序
map<char,int> mp;//一个map,记录每个数字对应的字母
mp.clear();//清空
mp['A']=a[0];
mp['B']=a[1];
mp['C']=a[2];
//一一对应
string s;//字符串
cin>>s;//输入
cout<<mp[s[0]]<<" "<<mp[s[1]]<<" "<<mp[s[2]];
//根据对应关系来输出
return 0;
}
```
by OIer_wyh @ 2024-01-27 12:37:20
下面的是大佬用的map,比较难懂,不明白没关系,我也看不懂
by czxuyang @ 2024-01-27 12:38:58
```cpp
#include<bits/stdc++.h>
using namespace std;
int main() {
int a[3];//数组
cin>>a[0]>>a[1]>>a[2];//输入
sort(a,a+3);//排序
int mp[100];
mp['A']=a[0];
mp['B']=a[1];
mp['C']=a[2];
//一一对应
string s;//字符串
cin>>s;//输入
cout<<mp[s[0]]<<" "<<mp[s[1]]<<" "<<mp[s[2]];
//根据对应关系来输出
return 0;
}
```
现在懂了吗
by OIer_wyh @ 2024-01-27 12:40:34
```cpp
#include<iostream>
#include<algorithm>
using namespace std;
int a[3];
char A,B,C;
int main()
{
cin>>a[0]>>a[1]>>a[2];
cin>>A>>B>>C;
sort(a,a+3);排序法
cout<<a[A-'A']<<" "<<a[B-'A']<<" "<<a[C-'A'];//字母是大写,减去‘A’后得到0(A),1(B),2(C)。
return 0;
}
```
另一位大佬写的,简洁深刻
by czxuyang @ 2024-01-27 12:42:54
谢谢两位大佬
by xiaohaibao @ 2024-01-27 17:06:20
已AC
再此结帖
by xiaohaibao @ 2024-01-27 17:07:08