Hi Counter
Finding a short substring is a basic skill for working with text, logs, and messages. Write a function count_hi that takes a string s and counts how many times the substring hi appears in it. Return that count as an integer.
Примеры
Ввод
"abc hi ho"Вывод
1Ввод
"ABChi hi"Вывод
2Ввод
"hihi"Вывод
2Нужно реализовать
def count_hi(s: str) -> int:
Теги
strings
Kirjaudu sisään nähdäksesi palautushistorian
Kirjaudu sisäänKirjaudu sisään käyttääksesi tekoälymentoria
Kirjaudu sisäänVisible tests
1
Input
"abc hi ho"Expected
12
Input
"ABChi hi"Expected
23
Input
"hihi"Expected
24
Input
"hellohi"Expected
15
Input
"xxhixx"Expected
16
Input
""Expected
0Focus radio
Paused · SomaFM · Fluid