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
PostgreSQLv16

Aquí aparecerá el resultado de la ejecución del código

Visible tests
1
Input
"abcxx"
Expected1
2
Input
"xxx"
Expected2
3
Input
"xxxx"
Expected3
4
Input
"abc"
Expected0
5
Input
"Hello there"
Expected0
6
Input
"xx"
Expected1
Focus radio
Paused · SomaFM · Fluid