using System; using System.Collections.Generic; using System.Linq; using System.Text; public class Program { public static void Main() { var line = Console.ReadLine(); var sb = new StringBuilder(); while (!string.IsNullOrEmpty(line)) { int i; if (line.StartsWith("hamu")) { sb.Append(1); i = 4; } else { sb.Append(0); i = 3; } line = line.Substring(i, line.Length - i); } var chars = sb.ToString().ToCharArray(); int num = 0; foreach (var ch in chars) { num += ch - '0'; num <<= 1; } var bin = Convert.ToString(num, 2); Console.WriteLine(bin.Replace("1", "hamu").Replace("0", "ham")); } }