import java.util.Scanner;

public class HerbalGardenSorter {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String garden = sc.nextLine().trim();
        sc.close();

        // Check length constraint
        if (garden.length() >= 100) {
            System.out.println("Invalid input");
            return;
        }

        // Count variables for herbs
        int countM = 0, countL = 0, countS = 0, countT = 0;

        // Validate and count herbs
        for (int i = 0; i < garden.length(); i++) {
            char ch = garden.charAt(i);
            switch (ch) {
                case 'M': countM++; break;
                case 'L': countL++; break;
                case 'S': countS++; break;
                case 'T': countT++; break;
                default:
                    System.out.println("Invalid input");
                    return;
            }
        }

        // Construct sorted output: M → L → S → T
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < countM; i++) result.append('M');
        for (int i = 0; i < countL; i++) result.append('L');
        for (int i = 0; i < countS; i++) result.append('S');
        for (int i = 0; i < countT; i++) result.append('T');

        System.out.println(result);
    }
}
