s=input() lst=s.split(",") res=0 for i in range(1,len(lst)-1): if lst[i]=="...": n=int(lst[i-1]) m=int(lst[i+1]) res=m-n-1 print(res)