We store all the indexes of maximum characters we have in the string
for ( let i = 0 ; i < str . length ; i ++ ) { if ( str [ i ] >= maxchar ) { maxchar = str [ i ] ; index . push ( i ) ; } } let maxstring = " " ;