Reccurrence relation for this problem is

$a_{n} = a_{n-1} + n$ where $a_i, i >= 1$ is numbers of subtrings till $i_{th}$ position of the string with $a_0 = 1$. It's solution is $1+n(n+1)/2$

$a_{n} = a_{n-1} + n$ where $a_i, i >= 1$ is numbers of subtrings till $i_{th}$ position of the string with $a_0 = 1$. It's solution is $1+n(n+1)/2$