Given a grid containing the characters 'X', 'Y', and '.'.
Return the number of submatrices that include the top left cell grid[0][0], contain at least 'X', and have an equal frequency of 'X' and 'Y'.
Constraints:
grid.length, grid[i].length
grid[i][j] is either 'X', 'Y', or '.'.
Given a grid containing the characters 'X', 'Y', and '.'.
Return the number of submatrices that include the top left cell grid[0][0], contain at least 'X', and have an equal frequency of 'X' and 'Y'.
Constraints:
grid.length, grid[i].length
grid[i][j] is either 'X', 'Y', or '.'.