You are viewing a single comment's thread. Return to all comments →
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'))
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 →
!/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'))