Up and Down by tttaki

import Char
import List
f '+'=1
f '-'=(-1)
f ' '=0
f c=ord c
h n=("\31 !"++[chr n])!!min(n+1)3
main=interact$map(h.foldl(+)0.map f).transpose.lines

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

download

return to the top page