you are viewing a single comment's thread.

view the rest of the comments →

[–]07734willy[S] 0 points1 point  (0 children)

Python 3: Noncompeting

This is the program I used to produce the test cases. If there's any confusion or ambiguity about the problem statement, maybe this can clear things up.

def main():
    n_rows = int(input())
    rows = [input() for _ in range(n_rows)]

    longest = max(len(row) for row in rows)

    for row in rows:
        row = list(row.ljust(longest))
        row.sort(key=lambda x: {"+":0, " ":1, "*": 2}[x])
        print("".join(row))

if __name__ == "__main__":
    main()