using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Linq.Expressions; using static System.Console; using static System.Math; using static Ex; class Program { public static void Main(string[] args) => new Program().Stream(); IO_TINY io = new IO_TINY(); void Stream() { //var exStdIn = new System.IO.StreamReader("stdin.txt"); //SetIn(exStdIn); Solve(); io.Flush(); } void Solve() { var hamNum = io.String; var hamBin = ""; while (hamNum.Length > 0) { if (hamNum.Length >= 4) { if (hamNum.Substring(0, 4) == "hamu") { hamBin += "1"; hamNum = hamNum.Substring(4); } else if (hamNum.Substring(0, 3) == "ham") { hamBin += "0"; hamNum = hamNum.Substring(3); } else { throw new Exception(); } } else if (hamNum.Length >= 3) { if (hamNum.Substring(0, 3) == "ham") { hamBin += "0"; hamNum = hamNum.Substring(3); } else { throw new Exception(); } } else { throw new Exception(); } } var hamInt = hamBin.Bin2Int() * 2; var newHam = hamInt .Int2Bin() .Select(c => { switch (c) { case '0': return "ham"; case '1': return "hamu"; default: throw new Exception(); } }) .Aggregate((acc, a) => acc + a); WriteLine(newHam); } } class IO_TINY { string[] _nextBuffer; int _bufferCnt; char[] cs = new char[] { ' ', '"', ',' }; StreamWriter sw = new StreamWriter(OpenStandardOutput()) { #if DEBUG AutoFlush = true #else AutoFlush = false #endif }; public IO_TINY() { _nextBuffer = new string[0]; _bufferCnt = 0; SetOut(sw); } string Next() { if (_bufferCnt < _nextBuffer.Length) return _nextBuffer[_bufferCnt++]; var st = ReadLine(); while (st == string.Empty) st = ReadLine(); _nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); _bufferCnt = 0; return _nextBuffer[_bufferCnt++]; } public string String => Next(); public char Char => char.Parse(String); public int Int => int.Parse(String); public long Long => long.Parse(String); public double Double => double.Parse(String); public void Flush() => Out.Flush(); } static class Ex { public static string Int2Bin(this int x) => Convert.ToString(x, 2); public static int Bin2Int(this string bin) => Convert.ToInt32(bin, 2); }