import sys from sys import stdin def compute_sum(n): total = 0 k = 1 while (1 << (k-1)) <= n: start = 1 << (k-1) end = (1 << k) - 1 if end > n: end = n cnt = end - start + 1 total += cnt * k k += 1 return total def find_n(L): left = 1 right = 2 * 10**5 # A safe upper bound while left <= right: mid = (left + right) // 2 s = compute_sum(mid) if s == L: return mid elif s < L: left = mid + 1 else: right = mid - 1 return -1 def main(): C = stdin.read().strip() L = len(C) N = find_n(L) if N == -1: print("No solution found") return # Precompute binary representations bin_dict = {} for x in range(1, N+1): s = bin(x)[2:] # Convert to binary without '0b' bin_dict[s] = x # Now, perform backtracking to find the permutation used = set() path = [] found = False def backtrack(pos): nonlocal found if pos == L: print(' '.join(map(str, path))) found = True return if found: return # Try all possible binary strings starting at pos # Check all possible lengths l in bin_dict for s in bin_dict: l = len(s) if pos + l > L: continue if C[pos:pos+l] == s: x = bin_dict[s] if x not in used: used.add(x) path.append(x) backtrack(pos + l) if found: return path.pop() used.remove(x) backtrack(0) if not found: print("No solution found") if __name__ == "__main__": main()