Driver code
let str = " " . split ( " " ) ; let n = str . length ; let tree = new Array ( max ) ; for ( let i = 0 ; i < tree . length ; i ++ ) { tree [ i ] = new Array ( 27 ) ; for ( let j = 0 ; j < tree [ i ] . length ; j ++ ) { tree [ i ] [ j ] = 0 ; } } buildBIT ( tree , str , n ) ; qType1 ( tree , 4 , ' ' , str ) ; qType2 ( tree , 1 , 4 , str ) ; qType2 ( tree , 2 , 3 , str ) ; qType1 ( tree , 10 , ' ' , str ) ; qType2 ( tree , 10 , 11 , str ) ;