# DARY - Editorial

[Practice][111]
[Contest][222]

SIMPLE

Basic Maths

### PROBLEM:

You are given a string of length N. In each testcase, you have to find number of substrings of even length for the given string.

### EXPLANATION:

You are given a string of length N. The total number of substrings with even length are
(n - 1) + (n - 3) + (n - 5) + … k

Now,

	n + n + n + ....k - (1 + 3 + 5 +........k)

n * k - $\sum_{i=1}^{k}$ (2 * i) - 1

(n * k) - (k * k)

k * (n - k)

where k = $\lfloor$n / 2$\rfloor$


### AUTHOR’S SOLUTIONS:

Author’s solution can be found [here][333].
[111]: https://www.codechef.com/problems/DARY
[222]: https://www.codechef.com/COHR2018/problems/DARY