<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><style type="text/css">div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #40a070; }
code > span.fl { color: #40a070; }
code > span.ch { color: #4070a0; }
code > span.st { color: #4070a0; }
code > span.co { color: #60a0b0; font-style: italic; }
code > span.ot { color: #007020; }
code > span.al { color: #ff0000; font-weight: bold; }
code > span.fu { color: #06287e; }
code > span.er { color: #ff0000; font-weight: bold; }
</style></head><body><div class="sourceCode"><pre class="sourceCode"><code class="sourceCode">words =<span class="ot" title="OtherTok"> %w(</span><span class="st" title="StringTok">A BaRK BOoK tREaT COmMOn SqUAD CoNfuSE</span><span class="ot" title="OtherTok">)</span> << <span class="st" title="StringTok">""</span>
words.each <span class="kw" title="KeywordTok">do</span> |word|
blocks = <span class="st" title="StringTok">"BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM"</span>
res = word.each_char.all?{|c| blocks.sub!(<span class="ot" title="OtherTok">/\w?#{</span>c<span class="ot" title="OtherTok">}\w?/i</span>, <span class="st" title="StringTok">""</span>)} <span class="co" title="CommentTok">#regexps can be interpolated like strings</span>
puts <span class="st" title="StringTok">"</span><span class="ot" title="OtherTok">#{</span>word.inspect<span class="ot" title="OtherTok">}</span><span class="st" title="StringTok">: </span><span class="ot" title="OtherTok">#{</span>res<span class="ot" title="OtherTok">}</span><span class="st" title="StringTok">"</span>
<span class="kw" title="KeywordTok">end</span>
</code></pre></div></body>