Relatives#183

Relatives

1 second
64 megabytes
Easy
orcs

Orc names are not only expressive but can also reveal family connections. Two orcs are considered first-degree relatives if their names can be made identical by removing no more than half of the letters from each name. For example, the names orgrim and grom are first-degree relatives because you can remove three out of six letters (o, r, i) from "orgrim" and one out of four letters (o) from "grom" to get the identical name grm.

Two orcs with names and are considered relatives of the (n+1)-th degree if there exists a name such that orcs with names and are first-degree relatives, and and are -th degree relatives. If two orcs are -th degree relatives, they are also relatives in any degree m > n. However, the degree of kinship is determined by the smallest degree in which they are relatives.

Write a program to determine the degree (n \ge 1) of kinship between two orcs with given names.

Input

The input consists of two lines, each containing the name of an orc, composed of lowercase Latin letters. Each name consists of at least and at most letters.

Output

Output the degree of kinship between the orcs with the given names, or print the string not related (without quotes) if the two orcs are not related in any degree .

Examples

Example 1

Loading
Loading