Advertisement
Farjana_akter

Untitled

Feb 1st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. char s[1000];
  7. int a,i,j,k,b,c,d,e;
  8. while(gets(s))
  9. {
  10. a=strlen(s);
  11. for(i=0;i<a;i++)
  12. {
  13. if(s[i]==' '||i==(a-1))
  14. {
  15. if(s[i]==' ')
  16. b=i-1;
  17. else
  18. b=i;
  19. for(j=b;j>=0;j--)
  20. {
  21. if(s[j]==' '){
  22. break;}
  23. else
  24. cout<<s[j];
  25. }
  26. if(i!=(a-1))
  27. cout<<" ";
  28. }
  29. }
  30. cout<<endl;
  31. }
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement