A string is said to be a "special" string if either of two conditions are met:
A special substring is any substring of a string that meets one of those criteria. Given a string, determine how many special substrings can be formed from it.
Given the string s = "mnonopoo" we have the following special substrings:
{ "m", "n", "o", "n", "o", "p", "o", "o", "oo", "non", "ono", "opo" }
You just have to return the total number of that special substrings. In this case, it is 12. Another example is s = "aaaa", so the substrings will be:
{ "a", "a", "a", "a", "aa", "aa", "aa", "aaa", "aaa", "aaaa" }
# The function will return 10
special_string("mnonopoo") ➞ 12
special_string("asasd") ➞ 7
special_string("aaaa") ➞ 10
N/A