s = `sed "s/hamu/1/g" | sed "s/ham/0/g"` b = (s.to_i(2) * 2).to_s(2) r = `echo "#{b}" | sed "s/1/hamu/g" | sed "s/0/ham/g"` puts r