fork download
  1. #include<stdio.h>
  2. #define length 1024
  3.  
  4. int main()
  5. {
  6. char a[length],b[length],c[length];
  7. int i=1;
  8. a[0]=' ';
  9. while(scanf("%c",&a[i])!=EOF){
  10. int n=0,m=0;
  11. if(a[i]=='\n'){
  12. for(int j=i-1; j>=0; j--){
  13. b[n]=a[j];
  14. if(b[n]==' '){
  15. for(int k=n-1; k>=0; k--){
  16. c[m]=b[k];
  17. printf("%c",c[m]);
  18. m++;
  19. }
  20. printf(" ");
  21. m=0;
  22. n=0;
  23. }
  24. else {
  25. n++;
  26. }
  27. }
  28. printf("\n");
  29. i=1;
  30. }
  31.  
  32. else if(a[i]!='\n'){
  33. i++;
  34. }
  35. }
  36. }
Success #stdin #stdout 0s 4552KB
stdin
sentence. test sample a is This
University. Christian Yuan Chung the means CYCU
A. is English the in letter first The
Z. is English the in letter last The
stdout
This is a sample test sentence. 
CYCU means the Chung Yuan Christian University. 
The first letter in the English is A. 
The last letter in the English is Z.