解决方法
这是神奇的变量之一.
$_保存从标准输入读取的最后一行的值.因此,$_ [0]是该字符串的第一个符号.
有关更多魔术变量,请参阅English.rb
# The last line read by <tt>Kernel.gets</tt> or # <tt>Kernel.readline</tt>. Many string-related functions in the # +Kernel+ module operate on <tt>$_</tt> by default. The variable is # local to the current scope. Thread local. alias $LAST_READ_LINE $_