class Solution:
    def reformat(self, s: str) -> str:
        nums, strings = [], []
        for i in s:
            if i in "1234567890":
                nums.append(i)
            else:
                strings.append(i)
        if abs(len(nums)-len(strings)) > 1:
            return ""
        ans = ""
        while nums and strings:
            ans += nums.pop() + strings.pop()
        if strings:
            ans = strings.pop() + ans
        if nums:
            ans += nums.pop()
        return ans

da719c54d04dd8b44e40a95a633207793245253a
<mask token>

class Solution:
    <mask token>

class Solution:

    def reformat(self, s: str) ->str:
        nums, strings = [], []
        for i in s:
            if i in '1234567890':
                nums.append(i)
            else:
                strings.append(i)
        if abs(len(nums) - len(strings)) > 1:
            return ''
        ans = ''
        while nums and strings:
            ans += nums.pop() + strings.pop()
        if strings:
            ans = strings.pop() + ans
        if nums:
            ans += nums.pop()
        return ans

class Solution:
    def reformat(self, s: str) -> str:
        nums, strings = [], []
        for i in s:
            if i in "1234567890":
                nums.append(i)
            else:
                strings.append(i)
        if abs(len(nums)-len(strings)) > 1:
            return ""
        ans = ""
        while nums and strings:
            ans += nums.pop() + strings.pop()
        if strings:
            ans = strings.pop() + ans
        if nums:
            ans += nums.pop()
        return ans
