blob: 13b12096106f4309ca20f37fd5e4042a2a59afc9 (
plain) (
blame)
1
2
3
4
5
6
|
BEGIN { x = y = 1; homes[x][y] = 1; acc = 1 }
$0 == "^" { if (!homes[x][++y]++) acc++; next }
$0 == ">" { if (!homes[++x][y]++) acc++; next }
$0 == "v" { if (!homes[x][--y]++) acc++; next }
$0 == "<" { if (!homes[--x][y]++) acc++; next }
END { print acc }
|