Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <list>
- using namespace std;
- int main()
- {
- list<char> l;
- list<char>::iterator it;
- char c;
- while (cin >> c) {
- if (c == '.') {
- break;
- }
- else {
- l.push_back(c);
- }
- }
- it = l.begin();
- while (it != l.end())
- {
- if (*it == '#')
- {
- it = l.erase(it);
- if (it != l.begin())
- {
- it--;
- it = l.erase(it);
- if (it != l.begin())
- {
- it--;
- }
- }
- }
- else {
- it++;
- }
- }
- for (it = l.begin(); it != l.end(); it++) {
- cout << *it;
- }
- }
- /**
- #######1#23##HE345###LL06783####
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement