#!/usr/local/bin/ruby class String def expand(n=2) self.gsub(/./) { |m| m * n } end end my_name = "charlie" my_name.length # => 7 my_name.expand # => "cchhaarrlliiee"