26 NAND Gates
Consider a smaller subproblem,
f = AB + BC + CD // 3 pairs
= $\overline{\overline{AB + BC + CD}}$
= $\overline{{\overline{AB}.\overline{BC}.\overline{CD}}}$
So we can realize f in 4 NAND Gates, each for $\overline{AB}$, $\overline{BC}$, $\overline{AC}$ and f.
We can generalize the formula as " number of pairs + 1 (for f)" NAND gates to realize a similar kind of function.
Now, in f = AB+BC+CD+DE+................+YZ , we have 25 pairs. So we require 26 NAND gates.