Function to generate the sum of indices
void sumOfIndices ( string s ) { int N = s . size ( ) ; int x = int ( ceil ( log2 ( N ) ) ) ; int seg_size = 2 * ( int ) pow ( 2 , x ) - 1 ; int segment [ seg_size ] = { 0 } ; int count = 0 ;