If str [ i ] is between a and z and i is the last occurence in str
if ( ( str [ i ] . charCodeAt ( 0 ) >= ' ' . charCodeAt ( 0 ) && str [ i ] . charCodeAt ( 0 ) <= ' ' . charCodeAt ( 0 ) ) && small [ str [ i ] . charCodeAt ( 0 ) - 97 ] == i ) { let occ = str [ i ] . charCodeAt ( 0 ) - 96 ; while ( occ -- ) { res += str [ i ] ; } }