Edward has a string s of lowercase English letters that he repeated infinitely many times. Given an integer n, find and print the number of letter "a"s in the first n letters of Edward's infinite string. For example, if the string s=abcac and n=10, the substring we consider is abcacabcac, the first 10 characters of his infinite string. There are 4 occurrences of a in the substring.
Complete the repeatedString() method. It should return an integer representing the number of occurrences of a in the prefix of length n in the infinitely repeating string.
repeatedString("aba", 10) ➞ 7
repeatedString("a", 1000000000000) ➞ 1000000000000
repeatedString("aab", 882787) ➞ 588525