#include<stdio.h> #include<string.h> int main(){ char word[20]; char WOD[20]; gets(word); int i,j,m=0,n; int len=strlen(word); for(i=0;i<len+1;i++){ if(word[i]==' '||word[i]=='\0'){ n=i-1; while(m<=i-1){ WOD[n--]=word[m]; m++; } m=i+1; if(i!=len) WOD[i]=' '; } } printf("%s",WOD); } |
Double click to view unformatted code.