Category : erase

I am trying to erase particular characters using the erase() function from a string but its not working. Here is the code: #include <bits/stdc++.h> #define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define int long long int using namespace std; int32_t main() { ios; int t; cin>>t; while(t–) { string s; cin>>s; int i; for(i=0;i<s.length();i++) { if(s[i]==’A’&&s[i+1]==’B’) { s.erase(i,i+1); cout<<s<<"n"; ..

Read more

Some pieces of my code crash randomly when call push_back or erase on std::list, the code is in a long time runing service . I removed the unimportant part and just keep the most relevant. std::list<RxCCPReport> pendingSync; size_t AnchorConnection::HandleCCPTxReport(const char *rxBytes, size_t length) { if (!pendingSync.empty()) { std::list<RxCCPReport>::iterator iter = pendingSync.begin(); while (iter != pendingSync.end()) ..

Read more