Created
November 25, 2014 13:50
-
-
Save amoshyc/a7eba1a395b061430bec 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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main() { | |
char input[100][100 + 2]; | |
int idx = 0; | |
int max_len = 0; | |
while (fgets(input[idx], 100+2, stdin) != NULL) { | |
int len = strlen(input[idx]); | |
if (input[idx][len-1] == '\n') { | |
input[idx][len-1] = '\0'; | |
len--; | |
} | |
if (len > max_len) | |
max_len = len; | |
idx++; | |
} | |
const int N = idx; | |
int i, j; | |
for (i=0; i<max_len; i++) { | |
for (j=N-1; j>=0; j--) { | |
if (i >= strlen(input[j])) | |
printf(" "); | |
else | |
printf("%c", input[j][i]); | |
} | |
printf("\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment