def main(): import sys sys.setrecursionlimit(1 << 25) C = sys.stdin.readline().strip() L = len(C) # Step 1: Find N such that S(N) = L # S(N) is the sum of the binary lengths of 1..N N = 0 S = 0 while True: N += 1 b = N.bit_length() S += b if S == L: break elif S > L: # This should not happen as per problem statement print("No solution") return # Precompute binary strings for 1..N binary = {i: bin(i)[2:] for i in range(1, N+1)} lengths = {i: len(s) for i, s in binary.items()} # Now, find a permutation of 1..N such that their binary strings concatenated form C # We'll use a backtracking approach result = [] used = [False] * (N + 1) # 1-based def backtrack(pos): if pos == L: return True for k in range(1, N+1): if not used[k]: s = binary[k] l = lengths[k] if pos + l > L: continue if C[pos:pos+l] == s: used[k] = True if backtrack(pos + l): result.append(k) return True used[k] = False return False if backtrack(0): print(' '.join(map(str, reversed(result)))) else: print("No solution") if __name__ == "__main__": main()