Function to find if the grid can be made alternating
void findPossibleGrid ( int n , int m , char a [ ] [ 1001 ] ) { bool flag = true ; int k = -1 , o = -1 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( a [ i ] [ j ] != ' * ' ) {