# coding utf-8 s = int(input()) if set(s[1:]) == 1: print(len(s)-1) else: print(-1)