def backtrack(index, cur_subset, features, sols):
    if index == len(features):
        sols.append(list(cur_subset))
        return

    backtrack(index + 1, cur_subset, features, sols)

    cur_subset.append(features[index])
    backtrack(index + 1, cur_subset, features, sols)
    cur_subset.pop()


def solve():

    line = input()
    if not line:
        return
    features = line.strip().split()

    sols = []
    
    backtrack(0, [], features, sols)
    
    sols.sort(key=lambda x: (len(x), x))
    
    for s in sols:
        formatted_string = "{" + ", ".join(s) + "}"
        print(formatted_string)

if __name__ == "__main__":
    solve()

# Input:
# A B C

# Output:
# {}
# {A}
# {B}
# {C}
# {A, B}
# {A, C}
# {B, C}
# {A, B, C}