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

Задача 23092. Prefix


Задача

Темы: Символы Строки
Two words are given. Determine how many initial letters of the first word match the initial letters of the second word

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 contains two words separated by a space
Output: need to print the number of letters matching from the beginning

Sample input and output
Test number Input Output
1 fore forest 4
2 forest torest 0

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