Count in a Repeated String

Imagine repeating a string again and again until it becomes a very long tape of characters. The function repeated_string receives a string s and a number n. Look only at the first n characters of this repeated tape and count how many times the letter a appears.

Примеры

Ввод
"aba", 10
Вывод
7
Ввод
"a", 1000000
Вывод
1000000
Ввод
"abc", 3
Вывод
1

Нужно реализовать

def repeated_string(s: str, n: int) -> int:

Теги

stringsmath
PostgreSQLv16

Εδώ θα εμφανιστεί το αποτέλεσμα εκτέλεσης του κώδικα

Visible tests
1
Input
"aba", 10
Expected7
2
Input
"a", 1000000
Expected1000000
3
Input
"abc", 3
Expected1
4
Input
"bb", 100
Expected0
5
Input
"aaa", 7
Expected7
6
Input
"a", 999999
Expected999999
Focus radio
Paused · SomaFM · Fluid