fork download
  1. object Main extends App{var n,h,w=readInt;var a=1 to h map(_=>readLine);1 to n map{_=>n=w-1;a=a.map{_.map{c=>n+=1;s"...*$c....."(0 to 8 count(i=>a((n/w-i/3+h)%h)((n-i%3+1)%w)<46))}}};a.map(println)}
Success #stdin #stdout 0.57s 322432KB
stdin
30
40
35
...*.............*.*............*..
.....*.*...***......**......*......
**..........*..........*..*...**.**
...*...*...*.........*......**.*...
...*..*.......*.....**.*........**.
.**........**....*.......*......*..
...........*..*..*...*..*.......***
...*....*..............*......**...
.....*........*.*...*...*..**..*.*.
.....*.............*........*....**
....*......*.*..*..*.....*...*.....
........*.....*...*........*...*...
*...............*......*.*..****...
.*........*...**............*......
*..**...**.*......*.............**.
...*..*...*...**..*.........**.*...
......**........*.............**...
.***..*.*....*..***...**...........
.....*...**........................
..*...**........*.....*...*....**..
*....*....*....**..*........*......
........*....*****......*......*.**
........................*...*..**.*
*...*.....*..*......**....***....**
.....**......*......**.*........*.*
.*....*.*............*.*...........
.*......*.**...**................**
.......**.*...*...*..*....*..*..**.
....**..*...*...*..*......*..*.....
......*....*...*.*.*...............
..**.*..**........*.........*...*.*
....*..*.....*.**.............*.*..
...*..*.*..*..*.**..**..*......*...
..****.*....**.......*.........*.*.
.**.*......**.*....*.*..**.**...*..
........**..............*....*..*.*
..*...*.*....*...*..*.......*......
...**...**....*.*.*.***.*.*........
*..*....***.*...*..........*....*..
....*......*..*.......*...*..*.*...
stdout
**.....**......*..*.........*.....*
***.........................*.....*
.**...............................*
...............***..........*..*...
...........*...*............***....
..........**.......................
..........**..***..................
............*..**..................
............*..**..................
.............*.*...................
.............*.*...................
.............*.*...................
.**..........*.*...................
..............*....................
...................................
.................................**
.................................**
...................................
...................................
.......***.........................
.......*....................**.....
.......***..**.......**....*..*....
....................*.**..*........
..............*......*..*.*........
............*..*.....*..*.*........
...........**.**.......**....*.****
............*.*........*..***.***.*
...*.........*..........*.*..**....
...*.***...............**.....*....
........*...............*.****.....
.....*...................****......
.....*....................*........
......*...*........................
........*.*........................
.........*..................**.....
...........................*..*....
................*..........**.**...
....*..**......*.*..........*.**..*
.........*.....*...........**..*.**
....*....*.......**.........*...*..