Олимпиадный тренинг

Задача 23094. How many "n" before the decimal point


Задача

Темы: Символы Строки
An offer has been given. Count the number of "n" letters preceding the first comma of the sentence. 

Solve the problem without using the built-in string functions, except for a function that returns the length of a string.

Input: The first line is the original sentence.

Output:

Sample input and output
Test number Input Output
1 fore, sete. 0
2 hanah. 1

Запрещенные операторы:find;count