S = input()
def check(S):
    j = 0
    diff = []
    for ltr in S:
        if ltr == '?':
            j += 1
        else:
            if j not in diff:    
                diff.append(j)
            j = 0
    # print(diff)
    return max(diff)
print(check(S))