You are viewing a single comment's thread. Return to all comments →
More readable in Python3:
def repeatedString(s, n): a_count = s.count('a') reps = n//len(s) rest = n % len(s) count = a_count * reps + s[0:rest].count('a') return count
Seems like cookies are disabled on this browser, please enable them to open this website
Repeated String
You are viewing a single comment's thread. Return to all comments →
More readable in Python3: