noshin98

uva 483

Oct 13th, 2016
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. int l,i,j,b,k;
  6. char n[1000];
  7. while(gets(n))
  8. {
  9. l=strlen(n);
  10. b=-1;
  11. for(i=0;i<l;i++)
  12.  {
  13.  if(n[i]==' ')
  14.  
  15.  {
  16.  for(j=i-1;j>b;j--)
  17.  printf("%c",n[j]);
  18.  printf(" ");
  19.  b=i;
  20.  }
  21.  
  22. }
  23.  
  24. for(i=l-1;i>b;i--)
  25.  printf("%c",n[i]);
  26. printf("\n");
  27. }
  28. return 0;
  29. }
Add Comment
Please, Sign In to add comment