#include <iostream>
#include <string>
#include <list>

using namespace std;

list<string> createCodeList()
{
    list<string> codeList;
    string input;

    cout << "Enter your coded text: " << endl;
    getline(cin, input);
   
    string::size_type start = 0, end;
    while ((end = input.find("pe", start)) != string::npos)
    {
        codeList.push_back(input.substr(start, end-start));
        codeList.push_back("pe");
        start = end + 2;
    }
    if (start < input.size())
        codeList.push_back(input.substr(start));

    return codeList;
}

void removeCodeWords(list<string>& codeList)
{
    for (auto it = codeList.begin(); it != codeList.end(); )
    {
        if (*it == "pe")
        {
            it = codeList.erase(it);
        }
        else
        {
            ++it;
        }
    }
}

void printCodeList(const list<string>& codeList)
{
    for (const string& code : codeList)
    {
        cout << code;
    }
    cout << endl;
}

int main()
{
    list<string> codeList = createCodeList();
    removeCodeWords(codeList);
    printCodeList(codeList);
    return 0;
}