Initialize the dp vector
vector < vector < vector < int > > > dp ( N , vector < vector < int > > ( N , vector < int > ( 2 , -1 ) ) ) ; cout << N - findLongestSubstring ( 0 , 0 , A , B , 1 , N , dp ) ; }