• + 0 comments

    Python Solution:

    def repeatedString(s, n):
        # Write your code here
        count_in_s = s.count('a')
        full_repeats = n // len(s)
        remainder = n % len(s)
        count_in_remainder = s[:remainder].count('a')
        total = (count_in_s * full_repeats) + count_in_remainder
        return total