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

Задача 23095. First identical


Задача

Темы: Строки Символы
An offer has been given. Determine the serial numbers of the first pair of identical neighboring characters. If there are no such characters, then display the word NO.

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 a  sentence.

Output: you need to output serial numbers of the first pair of identical adjacent characters separated by a space, or the word "NO" - if there is no such pair of adjacent characters

Sample input and output
Test number Input Output
1 foresete NO
2 haah 2 3

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