string = input()
substring = 'f'
kst = len(string)
pos = string.find(substring)
newString = string[pos + 1:]
if pos == -1:
    print(-2)
elif pos != -1:
    pos2 = newString.find(substring)
    if pos2 == -1:
        print(pos2)
    else:
        print(pos2 + pos + 1)

a398445a92eb0d5a97f621f7f98fbb287e15263b
<mask token>

<mask token>
if pos == -1:
    print(-2)
elif pos != -1:
    pos2 = newString.find(substring)
    if pos2 == -1:
        print(pos2)
    else:
        print(pos2 + pos + 1)

string = input()
substring = 'f'
kst = len(string)
pos = string.find(substring)
newString = string[pos + 1:]
if pos == -1:
    print(-2)
elif pos != -1:
    pos2 = newString.find(substring)
    if pos2 == -1:
        print(pos2)
    else:
        print(pos2 + pos + 1)
