h = gets.chomp h.gsub!("hamu","1") h.gsub!("ham","0") h = h.to_i(2) h *= 2 h = h.to_s(2) h.gsub!("1","hamu") h.gsub!("0","ham") puts h