Filter all non-digit characters from string of grid digits; modify definition of "leaning" lines