Function to generate the sum of indices
static void sumOfIndices ( string s ) { int N = s . Length ; int x = ( int ) ( Math . Ceiling ( Math . Log ( N ) / Math . Log ( 2 ) ) ) ; int seg_size = 2 * ( int ) Math . Pow ( 2 , x ) - 1 ; int [ ] segment = new int [ seg_size ] ; int count = 4 ;