We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I'll explain here with an example, suppose the input is:
aba10
n = 10, means the string s = "aba" is repeated over the course of 10 letters, i.e. abaabaabaa.
Now, we break this string further down. First part, the exactly divisible part, s1 = "abaabaaba" and the second part, the remainder part, s2 = "a". To represent the count of a in s1 and s2, we have, int(n/len(s)) or n//len(s) and s[:n%len(s)], multiplied by count of a in s, respectively.
Repeated String
You are viewing a single comment's thread. Return to all comments →
I'll explain here with an example, suppose the input is:
n = 10, means the string s = "aba" is repeated over the course of 10 letters, i.e. abaabaabaa. Now, we break this string further down. First part, the exactly divisible part, s1 = "abaabaaba" and the second part, the remainder part, s2 = "a". To represent the count of a in s1 and s2, we have, int(n/len(s)) or n//len(s) and s[:n%len(s)], multiplied by count of a in s, respectively.