Problem Statement for mc1p5

**Mock CCC Contest 1 Problem 5 - Searching For Strings** With the introduction of Github Copilot, Leyang is concerned that people will use it on CCC and get into CCO without him! In order to avoid this at all costs, he has hacked into the CCC submission database where he finds two people's solutions to a problem. He suspects that these participants used Github Copilot if many segments of their code are identical. Find the number of pairs of identical substrings between their source code. **Formal instructions:** Let `substring(S, i, L)` denote the substring of string `S` of length `L` starting from index `i`. Given two strings `A` and `B`, determine the number of distinct integer tuples (x, y, k) in which `substring(A, x, k) == substring(B, y, k)`. The answer should fit in a 64-bit integer. *(Reminder: you can submit code as a file if it is too long)* **Input Specification:** The second line contains the string `A` of lowercase Latin alphabet characters. The first line contains the string `B` of lowercase Latin alphabet characters. **Output Specification:** On one line, the answer described in the problem statement. **Subtasks:** (`N` is the maximum length of each string) For 10% of the marks, `1 ≤ N ≤ 10`, the lengths of the strings will be equal. For an additional 20%, `1 ≤ N ≤ 50` For an additional 30%, `1 ≤ N ≤ 150` For full marks, `1 ≤ N ≤ 4000` **Sample Input 1:** ``` abc abc ``` **Output for Sample Case 1:** ``` 6 ``` **Explanation for Sample Case 1:** The 1-indexed pairs are as follows: `(1, 1, 1)`, `(2, 2, 1)`, `(3, 3, 1)`, `(1, 1, 2)`, `(2, 2, 2)`, `(1, 1, 3)`. **Sample Input 2:** ``` abxyzab jklablkjab ``` **Sample Output 2:** ``` 12 ```


🕑 Time limit: 7.0 seconds
 java: 15.0 seconds
 python: 15.0 seconds
⚎ Memory limit: 256.0 MB