9093
#include <stdio.h>
#include <string.h>
int main(void){
// 테스트 케이스 개수 입력
int test_case = 0;
scanf("%d", &test_case);
getchar(); // 버퍼 비우기 (\n)
for(int i = 0; i < test_case; i++){
// 문장 입력
char str[1001]={0};
gets(str);
int start = -1;
int len = strlen(str);
str[len] = 32;
for(int i = 0; i <= len; i++){
// start가 -1이고 현재 값이 공백이 아닐 경우
if((start == -1)&&(str[i] != 32)){
// start를 현재 인덱스로 변경
start = i;
}
// 현재값이 공백일 경우
if((str[i] == 32)){
// i-1 부터 start까지 출력 (단어 뒤집어서)
for(int j = (i-1); j >= start; j--){
printf("%c", str[j]);
}
printf(" ");
// start 초기화
start = -1;
}
}
printf("\n");
}
return 0;
}