Repeated String

  • [deleted]
    + 0 comments

    !/bin/python3

    import sys

    s = input().strip() n = int(input().strip()) c=s.count('a') f=int(n/len(s)) r=n%len(s) print(c*f+s[0:r].count('a'))