Recursive definition for the length of a string (length (w), w is a given string and is an integer?

I found some answers online but I do not quite understand why the answer is correct?

1)
The length of a chain is:

If a string does not contain any characters, its length is 0.

Otherwise, the length of the chain is 1 + length of the tail

2)

enter the description of the image here