https://pintia.cn/problem-sets/994805260223102976/exam/problems/1478634605024231424
此题很简单,注意一下输入格式就好,注意空格用getline读入就行了。
#include<bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
string al[26][7],str,world;
void solve(){
string out[7];
for (int i = 0; i < 7; i++)
for (int j = 0; j < world.size(); j++) {
int idx = world[j] - 'A';
if (j) out[i] += " ";
out[i] += al[idx][i];
}
for (int i = 0; i < 7; i++) cout << out[i] << endl;
}
int main() {
for (int i = 0; i < 26; i++)
for (int j = 0; j < 7; j++)
cin >> al[i][j];
getchar();
getline(cin,str);
bool st=false;
for(int i=0;i<str.size();i++) {
if(str[i]>='A'&&str[i]<='Z') world+=str[i];
else if(world.size()) {
if(st) cout<<endl;
st=true;
solve();
world.clear();
}
}
if(world.size()) {
if(st) cout<<endl;
solve();
world.clear();
}
return 0;
}