#include <bits/stdc++.h>

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    while(1) {
        string s;
        cin >> s;
        if(s == "#") break;

        auto f = [](char c) {
            char musei_siin[] = {'k', 's', 't', 'h', 'p'};
            REP(i, 5) if(c == musei_siin[i]) return true;
            return false;
        };
        auto g = [](char c) {
            char boin[] = {'a', 'i', 'u', 'e', 'o'};
            REP(i, 5) if(c == boin[i]) return true;
            return false;
        };

        const ll n = s.size();
        ll turn = 0, con = 0;
        char con_c = '?';
        vector<bool> x(n);
        REP(i, n) {
            // 無声子音 + (i or u) + 無声子音
            if((s[i]=='i' || s[i]=='u')) {
                bool cond1 = (i>0 && f(s[i-1])) || (i>1 && f(s[i-2]) && s[i-1]=='y');
                bool cond2 = (i==n-1) || (i+1<n && f(s[i+1])) || (i+2<n && s[i+1]==s[i+2] && f(s[i+1]));
                if(cond1 && cond2) x[i] = true;
            }
            // 無声子音 + (a or o) の連続
            if(turn == 0) {
                if(f(s[i]) && i+1<n && s[i+1]=='y') turn = 1, i++, con += 2;
                else if(f(s[i])) turn = 1, con++;
                else {
                    if(con >= 4) {
                        for(ll j=i-3; j>=i-con; j--) {
                            if(g(s[j])) x[j] = true;
                        }
                    }
                    turn = 0; con = 0; con_c = '?';
                }
            } else if(turn == 1) {
                if((con_c == '?' && (s[i]=='a' || s[i]=='o'))
                || con_c == s[i]) {
                    turn = 0, con++;
                    con_c = s[i];
                } else if(con_c != s[i] && (s[i]=='a' || s[i]=='o')) {
                    if(con >= 4) {
                        for(ll j=i-4; j>=i-con; j--) {
                            if(g(s[j])) x[j] = true;
                        }
                    }
                    turn = 0, con = 2, con_c = s[i];
                } else if(f(s[i])) {
                    if(con >= 4) {
                        for(ll j=i-4; j>=i-con; j--) {
                            if(g(s[j])) x[j] = true;
                        }
                    }
                    turn = 1; con = 1;
                } else {
                    if(con >= 4) {
                        for(ll j=i-4; j>=i-con; j--) {
                            if(g(s[j])) x[j] = true;
                        }
                    }
                    turn = 0; con = 0; con_c = '?';
                }
            }
        }
        // cout << x << endl;

        if(turn == 0) {
            if(con >= 4) {
                // cout << con << endl;
                for(ll j=n-3; j>=n-con; j--) {
                    if(g(s[j])) x[j] = true;
                }
            }
        } else if(turn == 1) {
            if(con >= 4) {
                for(ll j=n-4; j>=n-con; j--) {
                    if(g(s[j])) x[j] = true;
                }
            }
        }

        // cout << x << endl;

        vector<ll> idx;
        REP(i, n) if(g(s[i])) idx.push_back(i);
        FOR(i, 1, idx.size()) {
            if(x[idx[i-1]] && x[idx[i]]) {
                x[idx[i]] = false;
            }
        }

        REP(i, n) {
            if(x[i]) cout << "(" << s[i] << ")";
            else cout << s[i];
        }
        cout << endl;
    }


    return 0;
}



Measured memory_bytes: 3108