Peak Detection by tabasa

b=gets(p).split\x0d
def f a,c\x0d
c.times{|i|\x0d
s=a[c].to_i-a[c-i-1].to_i\x0d
s<0?(break):s>9?(return 1):0\x0d
}\x0d
0\x0d
end\x0d
z=b.reverse\x0d
k=b.size\x0d
k.times{|c|\x0d
print b[c]\x0d
print'*'if f(b,c)+f(z,k-c-1)>1\x0d
puts\x0d
}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page