#!/usr/bin/env ruby WORDS_REGEX = /\w+/ STDIN.each_line do |line| words = line.scan(WORDS_REGEX) puts words.map { |word| word.upcase } * '_' end