Creating the Binary Index Tree of all alphabet
void buildBIT ( int tree [ max ] [ 27 ] , char str [ ] , int n ) { memset ( tree , 0 , sizeof ( tree ) ) ; for ( int i = 0 ; i < n ; i ++ ) update ( tree , i + 1 , 1 , str [ i ] - 97 + 1 ) ; }