Advertisement
Guest User

Untitled

a guest
Aug 7th, 2021
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. string s;
  7. cin >> s;
  8. string dummy="";
  9. dummy+=s;
  10. string dummy2="";
  11. for(int i=0;i<s.size();i++)
  12. {
  13. if(s[i]!='a')
  14. {
  15. dummy2+=s[i];
  16. }
  17. }
  18. string a="";
  19. string b="";
  20. for(int i=0;i<dummy2.size()/2;i++)
  21. {
  22. a+=s[i];
  23. }
  24. for(int i=dummy2.size()/2;i<dummy2.size();i++)
  25. {
  26. b+=s[i];
  27. }
  28. if(a==b)
  29. {
  30. size_t t=dummy.find(b);
  31. int x=b.size();
  32. if(t!=string::npos)
  33. {
  34. dummy.erase(t,x);
  35. }
  36. cout << dummy;
  37. }
  38. else
  39. {
  40. cout << ":(";
  41. }
  42.  
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement