palavra = "palavra"
escolha = "a"
contagem = palavra.scan(/(?=#{escolha})/).count
puts "A palavra tem #{contagem} letras 'a' na palavra"
#http://pt.stackoverflow.com/q/187136/101
cGFsYXZyYSA9ICJwYWxhdnJhIgplc2NvbGhhID0gImEiCmNvbnRhZ2VtID0gcGFsYXZyYS5zY2FuKC8oPz0je2VzY29saGF9KS8pLmNvdW50CnB1dHMgIkEgcGFsYXZyYSB0ZW0gI3tjb250YWdlbX0gbGV0cmFzICdhJyBuYSBwYWxhdnJhIgoKI2h0dHA6Ly9wdC5zdGFja292ZXJmbG93LmNvbS9xLzE4NzEzNi8xMDE=