##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
5
2 1 ab
5 2 ababa
5 3 abcde
7 3 abacaba
8 3 abcabcaa
Erasing the first character leaves b, and erasing the second character leaves a. These two strings are different.
Every possible erasure leaves the string aba, so only one distinct string is written.
The three resulting strings are de, ae, and ab. They are all different.
All five possible erasures produce different strings.
The first five erasures all produce abcaa. The last erasure produces abcab, so there are two distinct strings.
2
1
3
5
2
You are given a string of length consisting of lowercase English letters, and an integer .
For each with , erase the contiguous substring from position to position , and write down the resulting string.
After doing this for all possible values of , count how many distinct strings have been written.