#include using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define watch(a) { cout << #a << " = " << a << endl; } template inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); } template inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); } typedef long long ll; int const inf = 1<<29; string hams[2] = {"hamu", "ham"}; int main() { string s; cin >> s; int st = 0; int x = 0; rep(i, s.size()) { rep(j, 2) { if(i + hams[j].size() > s.size()) continue; bool ok = 1; rep(k, hams[j].size()) { if(s[i + k] != hams[j][k]) { ok = 0; } } if(ok) { x <<= 1; if(j == 0) x += 1; st += hams[j].size(); i += hams[j].size() - 1; } } } x *= 2; stringstream ss; while(x > 0) { ss << hams[(1^x) & 1] << " "; x /= 2; } vector vs; while(ss >> s) vs.push_back(s); bool leading_ham = 0; for(int i=0; i