Remove characters s [ l ] and s [ i ] .
if ( s [ l ] == s [ k ] ) : NEW_LINE INDENT temp = calc ( l + 1 , k - 1 , s ) * calc ( k + 1 , r , s ) * choose [ ( r - l + 1 ) // 2 ] [ ( r - k ) // 2 ] ; NEW_LINE ans += temp ; NEW_LINE DEDENT dp [ l ] [ r ] = ans ; NEW_LINE return dp [ l ] [ r ] NEW_LINE def waysToClearString ( S ) : NEW_LINE