# use strict; # use warnings; chomp(my $s = <>); $s =~ s/hamu/1/g; $s =~ s/ham/0/g; my $n = 0; foreach (split(//, $s)) { $n <<= 1; $n |= $_; } my $b = sprintf('%b', $n * 2); $b =~ s/1/hamu/g; $b =~ s/0/ham/g; print($b, "\n");