import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        List<String> lst = Arrays.asList(str.split(""));
        List<String> newLst = new ArrayList<>();
        for (String s : lst) {
            if (s.matches("[^a-zA-Z]")) {
                newLst.add(" ");
            } else {
                newLst.add(s);
            }
        }
        String str1 = String.join("", newLst);
        String[] a = str1.split(" ");
        String[] result = new String[a.length];
        for (int i = a.length-1; i>=0; i--) {
            result[a.length-1 - i] = a[i].replaceAll(" ", "");
        }
        System.out.println(String.join(" ", result));
    }
}