print" ".join([w for w in raw_input().split() if sorted(w)==list(w) or w[2:]=="C"])