Separate the Numbers

  • + 0 comments
    a = s[0]
        for i in range(1, len(s)):
            if s[i] == '0':
                a += '0'
            else:
                dau=s[:i]
                break
        i = 2
        while len(a) < len(s) and i <= len(s) // 2+1:
            j = int(a) + 1
            while True:
                a += str(j)
                if len(a) > len(s):
                    break
                if a == s:
                    print("YES", int(dau))
                    return
                j += 1
            if a == s:
                print("YES", int(dau))
                return
            a = s[:i]
            dau=s[:i]
            i += 1
        print("NO")