s=input()
result=0
qus=s.count("?")
zeros=s.count("0")
ones=s.count("1")
result=abs(zeros-ones)
if qus%2 ==1:
  result+= -1
max1=1
max2=0
last=""
news=""
zeroorone=0
for subs in s:
  if subs == "?":
    if last=="0" and zeroorone <=0:
      news+="1"
      last="1"
      zeroorone+=1
    elif last =="1" and zeroorone >=0:
      news+="0"
      last="0"
      zeroorone+=-1
    else:
      if len(news)>1:
        if news[-1]=="0" and zeroorone <=0:
          news+="1"
          last="1"
          zeroorone+=1
        elif zeroorone >=0:
          last="0"
          news +="0"
          zeroorone+=-1
        else:
          last="1"
          news +="1"
          zeroorone+=1          
      else:
        news += "0"
        last="0"
        zeroorone+=-1
    max1=1
    #last=subs
    continue
  news += subs
  if last == subs:
    max1+=1
  else:
    max1=1
    last=subs
  max2=max(max1,max2)  
result=max(result,max2)
zeros=news.count("0")
ones=news.count("1")
max2=abs(zeros-ones)
result=max(result,max2)
print(news)
max1=1
last=""
max2=0
for subs in news:
  if last == subs:
    max1+=1
  else:
    max1=1
    last=subs
  max2=max(max1,max2)  
result=max(result,max2)
print(result)