CSES - Difference of one

Your task is to count how many ways you can form a string of length nn using the characters az so that any pair of adjacent characters in the string are also consecutive in the alphabetical order.

When n=2n=2, the answer is 5050. The first character of the string can be chosen freely from the range az (2626 options). If the first character is a or z, there is only one choice for the second character. Otherwise, there are two choices for the second character. Thus the total number of such strings is 2+242=502 + 24 \cdot 2 = 50.

When n=5n=5, the strings ababa, cdcba and bcdef are examples of valid strings.

In a file onediff.py, implement the function count_strings that takes the length of the strings as a parameter, and returns the number of the strings.

The function should be efficient when the string length is in the range 11001 \dots 100.

def count_strings(n):
    # TODO

if __name__ == "__main__":
    print(count_strings(1)) # 26
    print(count_strings(2)) # 50
    print(count_strings(3)) # 98
    print(count_strings(4)) # 192

    print(count_strings(42)) # 36766943673096
    print(count_strings(100)) # 7073450400109633000218032957656