UVA 490 Rotating Sentences

#include <cstdio>
#include <cstring>

int main() {
	char str[200][200] = {0};
	int n, max = 0; 
	for (n = 0; gets(str[n]); n++)
		if (max < strlen(str[n]))
			max = strlen(str[n]);
	for (int i = 0; i < max; i++) {
		for (int j = 0; j < n; j++)
			printf("%c", str[n - j - 1][i] == 0 ? ' ' : str[n - j - 1][i]);
		printf("\n");
	}
	return 0;
}

你可能感兴趣的:(UVA 490 Rotating Sentences)