We form a substring from that maximum character index till end and check if its greater that maxstring
for ( let i = 0 ; i < index . length ; i ++ ) { if ( str . substring ( index [ i ] , str . length ) > maxstring ) { maxstring = str . substring ( index [ i ] , str . length ) ; } } return maxstring ; }