class Solution:
def checkOnesSegment(self, s: str) -> bool:
if s == "1":
return True
l = []
for i in range(len(s)):
if s[i] == "1":
l.append(i)
if len(l) == 1:
return True
for i in range(len(l)):
if i > 0:
if l[i] - l[i-1] != 1:
return False
return True