You are viewing a single comment's thread. Return to all comments →
int main(){ string s; cin >> s; long n; cin >> n; long count=0; int i,k=s.size(); long p=n/k; for(i=0;i<s.size();i++){ if(s[i]=='a') count++; } count = count * p; for(i=0;i<(n%s.size());i++){ if(s[i]=='a') count++; } cout << count << endl; return 0; }
More simplified cpp solution,i hope this will be heplful
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 simplified cpp solution,i hope this will be heplful