Number of substrings in a string. The guitar originated in Spain in the 15th century.

Number of substrings in a string. Brute Force Solution.