n=gets;p (0..99*n.size).map{|i|x=n.to_i>>i;('%b'%(x/2)).count(?1)+x&1}.max