NOJ/60/main.c
Saturneric 52668c4122 Add.
2020-09-01 00:46:43 +08:00

28 lines
630 B
C

#include <stdio.h>
#include <string.h>
int main(void){
char string[1024], word[512][16];
gets(string);
printf("%s\n",string);
int i, len = strlen(string);
int if_l = 0, if_n = 0, count = -1, k = 0;
for(i = 0; i < len; i++){
if((string[i] >= 'a' && string[i] <= 'z') || (string[i] >= 'A' && string[i] <= 'Z'))
if_n = 1;
else if_n = 0;
if(if_n && !if_l){
k = 0;
word[++count][k++] = string[i];
}
else if(if_n && if_l) word[count][k++] = string[i];
else if(!if_n && if_l) if(~count) word[count][k] = '\0';
if_l = if_n;
}
for(i = count; ~i; i--){
printf("%s",word[i]);
}
printf("\n");
return 0;
}