#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <exception>
#include <algorithm>
#include <tuple>

using namespace std;

enum class MoraType
{
    BOIN,
    SHIIN_BOIN,
    SHIIN_Y_BOIN,
    SOKUON,
    HATSUON,
    TYOUON
};

struct Mora
{
    string text;
    MoraType type;
};

bool IsBoin(char c)
{
    switch (c) {
    case 'a':
    case 'i':
    case 'u':
    case 'e':
    case 'o':
        return true;
        break;
    default:
        return false;
        break;
    }
}

bool IsShiin(char c)
{
    switch (c) {
    case 'k':
    case 's':
    case 't':
    case 'n':
    case 'h':
    case 'm':
    case 'y':
    case 'r':
    case 'w':
    case 'g':
    case 'z':
    case 'd':
    case 'b':
    case 'p':
        return true;
        break;
    default:
        return false;
        break;
    }
}

Mora GetFirstMora(const string &str, string::iterator &it)
{
    char c0 = *it;

    if (it + 1 == str.end() && c0 == 'n') {
        Mora mora = { string(it, it + 1), MoraType::HATSUON };
        ++it;
        return mora;
    }
    if (IsBoin(c0)) {
        if ((c0 == 'a' || c0 == 'i' || c0 == 'u')
                && it != str.begin()
                && IsBoin(*(it - 1))) {
            Mora mora = { string(it, it + 1), MoraType::TYOUON };
            ++it;
            return mora;
        } else {
            Mora mora = { string(it, it + 1), MoraType::BOIN };
            ++it;
            return mora;
        }
    } else if (it + 1 != str.end()) {
        char c1 = *(it + 1);
        if (IsShiin(c0) && IsBoin(c1)) {
            Mora mora = { string(it, it + 2), MoraType::SHIIN_BOIN };
            it += 2;
            return mora;
        } else if (IsShiin(c0) && c1 != 'n' && c1 != 'y' && c1 != 'w' && c0 == c1) {
            Mora mora = { string(it, it + 1), MoraType::SOKUON };
            ++it;
            return mora;
        } else if (c0 == 'n' && c1 != 'y') {
            if (c1 == '\'') {
                Mora mora = { string(it, it + 2), MoraType::HATSUON };
                it += 2;
                return mora;
            } else {
                Mora mora = { string(it, it + 1), MoraType::HATSUON };
                ++it;
                return mora;
            }
        } else if (it + 2 != str.end()) {
            char c2 = *(it + 2);
            if (c0 != 'y' && c0 != 'w' && IsShiin(c0)
                    && c1 == 'y'
                    && IsBoin(c2)) {
                Mora mora = { string(it, it + 3), MoraType::SHIIN_Y_BOIN };
                it += 3;
                return mora;
            }
        }
    }
    throw exception();
}

bool IsMuseiShiin(string::const_iterator begin, string::const_iterator end)
{
    return equal(begin, end, "ky")
            || equal(begin, end, "sy")
            || equal(begin, end, "ty")
            || equal(begin, end, "hy")
            || equal(begin, end, "py");
}

bool IsMuseiShiin(const Mora &mora)
{
    switch (mora.type) {
    case MoraType::SHIIN_BOIN:
    case MoraType::SOKUON:
        return IsMuseiShiin(mora.text.begin(), mora.text.begin() + 1);
        break;
    case MoraType::SHIIN_Y_BOIN:
        return IsMuseiShiin(mora.text.begin(), mora.text.begin() + 2);
        break;
    default:
        break;
    }
    return false;
}

template <typename T>
T GetNext(T it)
{
    auto newIt = it;
    return ++newIt;
}

template <typename T>
T GetPrev(T it)
{
    auto newIt = it;
    return --newIt;
}

int main()
{
    string input;
    while (cin >> input) {
        if (input.find('#') != string::npos) {
            break;
        }
        list<Mora> moras;
        auto it = input.begin();
        while (true) {
            auto mora = GetFirstMora(input, it);
            moras.push_back(mora);
            if (it == input.end()) {
                break;
            }
        }
        list<list<Mora>::iterator> museiMoras;
        bool lastBoinIsMuseikaed = false;
        for (list<Mora>::iterator it = moras.begin(); it != moras.end(); ++it) {
            Mora mora = *it;
            if (!IsBoin(mora.text.back())) {
                continue;
            }
            if (!lastBoinIsMuseikaed) {
                if (mora.type != MoraType::TYOUON
                        && (mora.text.back() == 'i' || mora.text.back() == 'u')
                        && IsMuseiShiin(mora)
                        && (GetNext(it) == moras.end() || IsMuseiShiin(*GetNext(it)))) {
                    museiMoras.push_back(it);
                    lastBoinIsMuseikaed = true;
                } else if ((mora.text.back() == 'a' || mora.text.back() == 'o')
                           && IsMuseiShiin(mora)
                           && GetNext(it) != moras.end()
                           && IsMuseiShiin(*GetNext(it))
                           && mora.text.back() == GetNext(it)->text.back()) {
                    museiMoras.push_back(it);
                    lastBoinIsMuseikaed = true;
                } else {
                    lastBoinIsMuseikaed = false;
                }
            } else {
                lastBoinIsMuseikaed = false;
            }
        }

        for (list<Mora>::iterator it = moras.begin(); it != moras.end(); ++it) {
            Mora mora = *it;
            if (find(museiMoras.begin(), museiMoras.end(), it) == museiMoras.end()) {
                cout << mora.text;
            } else {
                cout << mora.text.substr(0, mora.text.length() - 1) << '(' << mora.text.back() << ')';
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1192