S=list(input()) S.sort(key=lambda x:('TCP'.index(x))) if set(S)==set('TP'): S=S[::-1] print(''.join(S))