Double X Counter
Sometimes you need to find not just one character, but a short repeated fragment inside a string. Write a function count_xx that takes a string s and counts how many times the substring xx appears in it. Overlapping matches count too: the string xxx contains two such fragments.
Примеры
Ввод
"abcxx"Вывод
1Ввод
"xxx"Вывод
2Ввод
"xxxx"Вывод
3Нужно реализовать
def count_xx(s: str) -> int:
Теги
strings
Accedi per vedere la cronologia degli invii
AccediAccedi per usare l'AI Mentor
AccediVisible tests
1
Input
"abcxx"Expected
12
Input
"xxx"Expected
23
Input
"xxxx"Expected
34
Input
"abc"Expected
05
Input
"Hello there"Expected
06
Input
"xx"Expected
1Focus radio
Paused · SomaFM · Fluid