Skip to content

Instantly share code, notes, and snippets.

@KT-Yeh
Created February 3, 2014 09:54
Show Gist options
  • Save KT-Yeh/8781200 to your computer and use it in GitHub Desktop.
Save KT-Yeh/8781200 to your computer and use it in GitHub Desktop.
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
// freopen ("input.txt","rt",stdin);
char sentence[101][101];
int N=0,length[101];
int Max_length=0;
while (gets(sentence[N])) {
length[N] = strlen(sentence[N]);
if (length[N] > Max_length) Max_length = length[N];
N++;
}
for (int i=0; i<Max_length; i++){
for (int j=N-1; j>=0; j--){
if (i < length[j])
printf("%c",sentence[j][i]);
else
printf(" ");
}
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment