#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
typedef pair<int, bool> sP;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

bool ism(char t) {
	return t == 'a' || t == 'i' || t == 'u' || t == 'e' || t == 'o';
}
bool alf(char t) {
	return 'a' <= t && t <= 'z';
}
bool iss(char t) {
	return t == 'k' || t == 's' || t == 't' || t == 'h' || t == 'p';
}
string s;
void solve() {
	int n = s.length();
	string ans;
	vector<string>u;
	rep(i, n) {
		string cur;
		if (i == n - 1) {
			cur.push_back(s[i]);
		}
		else {
			if (ism(s[i])) {
				cur.push_back(s[i]);
			}
			else {
				cur.push_back(s[i]);
				i++;
				if (ism(s[i])) {
					//母音
					cur.push_back(s[i]);
				}
				else if (s[i] == 'y'&&s[i - 1] != 'y'&&s[i - 1] != 'w') {
					//tyatyutyo
					cur.push_back(s[i]);
					i++;
					cur.push_back(s[i]);
				}
				else if (!alf(s[i])) {
					//han'ei
					cur.push_back('\'');
				}
				else {
					//促音か撥音
					i--;
				}
			}
		}
		u.push_back(cur);
	}
	vector<bool> exib;
	rep(i, u.size()) {
		bool f = false;

		rep(j, u[i].size()) {
			if (ism(u[i][j]))f = true;
		}
		if (f&&u[i].size() == 1) {
			if (i - 1 >= 0 && ism(u[i - 1].back()))f = false;
		}
		exib.push_back(f);
	}
	vector<bool> valid(u.size(),false);
	rep(i, u.size()) {
		if (!exib[i])continue;
		if (u[i].size() < 2)continue;
		if (u[i].back() == 'i' || u[i].back() == 'u') {
			if (iss(u[i][0])) {
				if (i == u.size() - 1) {
					valid[i] = true;
				}
				else if (iss(u[i + 1][0])) {
					valid[i] = true;
				}
			}
		}
		else if (u[i].back() == 'a' || u[i].back() == 'o') {
			if (iss(u[i][0])) {
				int le = i;
				while (i + 1 < u.size() && u[i + 1].size() >= 2 && iss(u[i + 1][0]) && u[i + 1].back() == u[i].back()) {
					i++;
				}
				Rep(j, le, i) {
					valid[j] = true;
				}
			}
		}
	}
	bool can = true;
	rep(i, u.size()) {
		if (exib[i]) {
			if (!can) {
				can = true;
				ans += u[i];
			}
			else {
				if (valid[i]) {
					can = false;
					rep(j, u[i].size()) {
						if (ism(u[i][j])) {
							ans.push_back('(');
							ans.push_back(u[i][j]);
							ans.push_back(')');
						}
						else {
							ans.push_back(u[i][j]);
						}
					}
				}
				else {
					ans += u[i];
				}
			}
		}
		else {
			ans += u[i];
		}
	}
	cout << ans << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(7);
	//init();
	while (cin >> s) {
		if (s == "#")break;
		solve();
	}
	//stop
	return 0;
}




Measured memory_bytes: 3048