You are viewing a single comment's thread. Return to all comments →
import sys s = input().strip() n = int(input().strip())
import sys
s = input().strip() n = int(input().strip())
l = len(s) if(l==1 and s=='a'): print(n) else: c = s.count('a') c *= n//l s = s[:(n%l)] c+=s.count('a') print(c)
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 →
import sys
s = input().strip() n = int(input().strip())
l = len(s) if(l==1 and s=='a'): print(n) else: c = s.count('a') c *= n//l s = s[:(n%l)] c+=s.count('a') print(c)