Write a function numberOfBalancedStrings(int n, int d) that counts the number of balanced strings of size n, where a balanced string has adjacent characters differing by at most d.
Assume strings use lowercase English letters from a through z, represented by values 0 through 25. Return the count of valid strings as an integer. The assessment reported n = 3, d = 3 -> 224 and n = 2, d = 2 -> 124; clarify the character universe if these examples are used as grading requirements.
numberOfBalancedStrings(n, d) receives two integers and returns an integer count. A string is valid when every adjacent pair has absolute value difference at most d.
def numberOfBalancedStrings(n, d):