#include <bits/stdc++.h>
using namespace std;

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

inline bool isboin(char c){
  return c=='a'||c=='i'||c=='u'||c=='e'||c=='o';
}

inline bool ismusei(char c){
  return c=='k'||c=='s'||c=='t'||c=='h'||c=='p';
}

int main(){
  while(1){
    string s;
    cin >> s;
    if(s=="#") return 0;
    s+="  ";
    vector<pair<pair<char,char>,int>> haku;
    for(int i=0;i<s.length();i++){
      if(s[i]==' ') break;
      if(s[i]=='n'){
        if(isboin(s[i+1])){
          haku.push_back({{'n',s[i+1]},i+1});
          i++;
        }else{
          haku.push_back({{'n','x'},-1});
          if(s[i+1]=='\'') i++;
        }
      }else if(isboin(s[i])){
        if(i>0){
          if(s[i-1]=='a'||s[i-1]=='i'||s[i-1]=='u'){
            if(s[i-1]==s[i]){
              haku.push_back({{'x','-'},-1});
            }else{
              haku.push_back({{'x',s[i]},i});
            }
          }else if(s[i-1]=='e'){
            if(s[i]=='i'){
              haku.push_back({{'x','-'},-1});
            }else{
              haku.push_back({{'x',s[i]},i});
            }
          }else{
            if(s[i]=='u'){
              haku.push_back({{'x','-'},-1});
            }else{
              haku.push_back({{'x',s[i]},i});
            }
          }
        }else{
          haku.push_back({{'x',s[i]},i});
        }
      }else if(isboin(s[i+1])){
        haku.push_back({{s[i],s[i+1]},i+1});
        i++;
      }else{
        if(s[i+1]=='y'){
          haku.push_back({{s[i],s[i+2]},i+2});
          i+=2;
        }else if(s[i]==s[i+1]){
          haku.push_back({{'q','q'},-1});
          haku.push_back({{s[i+1],s[i+2]},i+2});
          i+=2;
        }
      }
    }
    // for(auto h:haku){
    //   cout << h.first.first SP h.first.second << endl;
    // }
    vector<bool> mu(s.length(),false);
    vector<bool> muh(haku.size(),false);
    for(int i=0;i<haku.size()-1;i++){
      if(haku[i].first.second=='i'||haku[i].first.second=='u'){
        if(ismusei(haku[i].first.first)&&(ismusei(haku[i+1].first.first)||(haku[i+1].first.first=='q'&&ismusei(haku[i+2].first.first)))){
          if(i>0){
            if(haku[i-1].first.first=='q'){
              if(!muh[i-2]){
                muh[i]=true;
                mu[haku[i].second]=true;
              }
            }else if(!muh[i-1]){
              muh[i]=true;
              mu[haku[i].second]=true;
            }
          }else{
            muh[i]=true;
            mu[haku[i].second]=true;
          }
        }
      }else if(haku[i].first.second=='a'||haku[i].first.second=='o'){
        if(haku[i].first.second==haku[i+1].first.second&&ismusei(haku[i].first.first)&&ismusei(haku[i+1].first.first)){
          if(i>0){
            if(haku[i-1].first.first=='q'){
              if(!muh[i-2]){
                muh[i]=true;
                mu[haku[i].second]=true;
              }
            }else if(!muh[i-1]){
              muh[i]=true;
              mu[haku[i].second]=true;
            }
          }else{
            muh[i]=true;
            mu[haku[i].second]=true;
          }
        }
      }
    }
    int i=haku.size()-1;
    if(haku[i].first.second=='i'||haku[i].first.second=='u'){
      if(ismusei(haku[i].first.first)){
        if(i>0){
          if(haku[i-1].first.first=='q'){
            if(!muh[i-2]){
              muh[i]=true;
              mu[haku[i].second]=true;
            }
          }else if(!muh[i-1]){
            muh[i]=true;
            mu[haku[i].second]=true;
          }
        }else{
          muh[i]=true;
          mu[haku[i].second]=true;
        }
      }
    }
    s=s.substr(0,s.length()-2);
    string ans="";
    for(int i=0;i<s.length();i++){
      if(mu[i]){
        ans+=(string)"("+s[i]+(string)")";
      }else{
        ans+=s[i];
      }
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3164