#include<bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; char mat[10][10]; char str[10][maxn]; int dir[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; int px[10]; bool check(int x, int y) { return x >= 0 && x < 8 && y >= 0 && y < 8; } void d...