s = gets.chomp i = 0 a = [] while(i < s.size) if(i+3 < s.size and ((s[i..i+3]) == "hamu")) i += 4 a.push(1) else i += 3 a.push(0) end end a.reverse! i = 0 while(i < a.size) a[i] *= 2 if(a[i] >= 2) if((i+1) != a.size) a[i + 1] += 1 else a.push(1) break end end a[i] %= 2 i += 1 end a.reverse! a.each do |d| if(d == 1) print "hamu" else print "ham" end end puts ""