Advertisement
Falak_Ahmed_Shakib

pb 16 word distroy

Jul 18th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. int i,j,k=0,t,len;
  6. char str[1000],word[1002];
  7. scanf("%d",&t);
  8. while(t--)
  9. {
  10. scanf(" %[^\n]",str);
  11.  
  12.  
  13. str[strlen(str)]=' ';
  14.  
  15. str[strlen(str)+1]='\0';
  16.  
  17.  
  18. for(i=0; str[i] ; i++)
  19. {
  20. if(str[i]!=' ')
  21. {
  22.  
  23. word[k]=str[i];
  24.  
  25. k++;
  26.  
  27. }
  28. else{
  29.  
  30. while(k>0)
  31. {
  32. k--;
  33.  
  34. printf("%c",word[k]);
  35. }
  36.  
  37. printf(" ");
  38.  
  39. k=0;
  40.  
  41. }
  42. }
  43. printf("\n");
  44.  
  45.  
  46. }
  47.  
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement