This function forms the required string
function reverseletter ( str , start , end ) { let wstart , wend ; for ( wstart = wend = start ; wend < end ; wend ++ ) { if ( str [ wend ] == ' ' ) { continue ; }