let's take an example:

s = ABC

length 0 = 1

lenght 1 = {A , B , C} = 3

length 2 = {AB , BC } = 2

length 3 = {ABC} = 1

total string = length 0 + length 1 + length 2 + length 3 = 1 + 3 + 2 + 1 = 7

option D is the correct answer

s = ABC

length 0 = 1

lenght 1 = {A , B , C} = 3

length 2 = {AB , BC } = 2

length 3 = {ABC} = 1

total string = length 0 + length 1 + length 2 + length 3 = 1 + 3 + 2 + 1 = 7

option D is the correct answer