Function to count maximum occurring subsequence using only those characters whose indexes are in GP
function findMaxTimes ( S ) { var arr = Array ( 26 ) . fill ( 0 ) ; var dp = Array . from ( Array ( 26 ) , ( ) => Array ( 26 ) . fill ( 0 ) ) ;