var s="*----"*8+"*\n" s+=(("| "*8+"|\n")*2+s)*8 for(c<-" ";a=Seq.fill(8)(readLine);i<-0 to 6;j<-0 to 7;k=126*j+5*i){if(a(i)(j)==a(i+1)(j))s=s patch(126*i+5*j+127," "*4,4) if(a(j)(i)==a(j)(i+1))s=s updated(k+47,c)updated(k+89,c)} print(s)