Given a matrix and an integer target, count the non-empty submatrices whose elements sum exactly to the target. Two submatrices are different if they differ in any cell coordinate. The input is JSON {matrix, target}.
Input: JSON {matrix, target}.
Output: Integer — the number of submatrices summing to target.
Input: {"matrix":[[0,1,0],[1,1,1],[0,1,0]],"target":0}
Output: 4
Explanation: Four submatrices sum to 0.Input: {"matrix":[[1,-1],[-1,1]],"target":0}
Output: 5
Explanation: Five submatrices sum to 0.Input: {"matrix":[[904]],"target":0}
Output: 0
Explanation: No submatrix sums to 0.1<=rows,cols<=100