There are 31 days in May.
Number of election days = 5
Number of non election days $= 31-5 =26$
Let the days on which election is to be held is denoted by $d$ .
So 31 days will look like $X_{1}dX_{2}dX_{3}dX_{4}dX_{5}d.X_{6}$ , where $X_{i}'s$ are the number of days between the election days .They will satisfy the following constraints...
$X_{1}+X_{2}+X_{3}+X_{4}+X_{5}+X_{6}= 26$
where $X_{1} \geq0$ , $X_{2} \geq1$, $X_{3} \geq1$, $X_{4} \geq1$, $X_{5} \geq1$, $X_{6} \geq0$
Now add $2$ on both sides of the equation and substitute $Y_{1} = 1+ X_{1}$, and $Y_{6} = 1+ X_{6}$ , we will get
$Y_{1}+X_{2}+X_{3}+X_{4}+X_{5}+Y_{6}= 28$
where $Y_{1} \geq1$ , $X_{2} \geq1$, $X_{3} \geq1$, $X_{4} \geq1$, $X_{5} \geq1$, $Y_{6} \geq1$
. By using generating functions or otherwise the answer is $\binom{n-1}{r-1} = \binom{27}{5}$
So $B$ is correct