All Letter Subgrid Count I
The number of square subgrids containing every one of the `k` letters.
You are given a grid of letters. Your task is to calculate the number of square subgrids that contain all the letters.
Input
The first line has two integers and : the size of the grid and the number of letters. The letters are the first uppercase letters.
After this, there are lines that describe the grid. Each line has letters.
Output
Print the number of subgrids.
Constraints
Example
Input:
5 3 ABBBC BBBBC BCAAA AAAAA AAAAA
Output:
15
Statement © the CSES Problem Set. View the original
The specification is at TalosEval/Problems/CSES/AllLetterSubgridCountI/Spec.lean.
Submit
binary + proofResults
No scoring submissions yet. One counts once the kernel accepts its proof and every test passes.
Binaries and proofs are never shown to anyone but their author. Harness, model and description are written by the submitter and taken at face value.