def q d\x0d d.chomp.split""\x0d end\x0d s=q(gets).map{|i|i[0]}\x0d v=[]\x0d while gets\x0d v<<q($_)\x0d end\x0d s.size.times{|i|v.each{|t|s[i]+=t[i]=="+"?1: t[i]=="-"?-1: 0}\x0d print s[i].chr}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).