Function to initialize the dp and call solveUtil ( ) method to get the answer
int solve ( string str , int K ) { int N = str . size ( ) ; dp . clear ( ) ; dp . resize ( N , vector < int > ( K , -1 ) ) ;