Created
February 3, 2014 09:54
-
-
Save KT-Yeh/8781200 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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