text: Update lexicographically smallest substring if the current count is equal to the maximum count
code: else if ( currCount == maxCount ) { String temp = str . substring ( i - K + 1 , i + 1 ) ; if ( temp . compareTo ( res ) < 0 ) res = temp ; } }