jakaria_hossain

codeforce - dubstep

Apr 10th, 2019
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int len,i,j=0,x;
  6. bool f=true;
  7. string s, ans;
  8. cin>>s;
  9. len=s.size();
  10. for(i=0;i<len; )
  11. {
  12. if(s[i]=='W' && s[i+1]=='U' && s[i+2]=='B')
  13. {
  14. i+=3;
  15. ans.push_back(' ');
  16. j++;
  17. }
  18. else
  19. {
  20. if(f)
  21. {
  22. f=false;
  23. x=j;
  24. }
  25. ans.push_back(s[i]);
  26.  
  27. i++;
  28. }
  29. }
  30. for(i=x;i<ans.size();i++)
  31. {
  32. if(ans[i]==' ' && ans[i+1]==' ')continue;
  33. else cout<<ans[i];
  34. }
  35. //cout<<ans;
  36. printf("\n");
  37. return 0;
  38. }
RAW Paste Data