Increment the count as digit at ( i - 1 ) 'th index is k and count  of good strings is equal to this  because at the end of the strings of  length (i - 1) we are just  putting digit j as the last digit
cnt [ i ] [ j ] += cnt [ i - 1 ] [ k ] ; NEW_LINE cnt [ i ] [ j ] %= MOD ; NEW_LINE