把字符串从下至上,从右至左写,同时空格变成'_'.回车变成'\',.
翻译的话反过来就行了,注意去掉尾部的空格..
不知道为什么,字符数组开在循环内部,但是每次不初始化就出错...
#include <iostream>
#include <cstring>
using namespace std;
int main(){
int l;
while(scanf("%d",&l)!=EOF){
char ch[1001][1001];
char res[1001];
for(int i=0;i<1001;i++){
res[i]='\0';
}
for(int i=0;i<l;i++){
scanf("%s",ch[i]);
}
int len=strlen(ch[0]);
int pos=0;
for(int i=len-1;i>=0;i--){
for(int j=l-1;j>=0;j--){
if(ch[j][i]=='_')res[pos++]=' ';
else if(ch[j][i]=='\\')res[pos++]='\n';
else res[pos++]=ch[j][i];
}
}
for(int i=pos-1;res[i]==' ';i--){
res[i]='\0';
}
printf("%s\n\n",res);
}
return 0;
}