package no423; import java.util.Scanner; public class Main { //遠回りした public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println(encode(2 * decode(sc.next()))); } public static long decode(String s) { return Long.parseLong(s.replaceAll("hamu", "1").replaceAll("ham", "0"), 2); } public static String encode(long x) { return Long.toBinaryString(x).replaceAll("0", "ham").replaceAll("1", "hamu"); } }