import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Stack<String> stack = new Stack<>();
Queue<String> queue = new LinkedList<>();
StringBuilder sb = new StringBuilder();
String[] arr = br.readLine().split("");
boolean tag = false;
for(String s : arr) {
if(tag) {
queue.add(s);
if(s.equals(">")) {
while(!queue.isEmpty()) { sb.append(queue.poll()); }
tag = false;
}
continue;
}
if(s.equals("<")) {
if(!stack.isEmpty()) {
while(!stack.isEmpty()) { sb.append(stack.pop()); }
}
queue.add(s);
tag = true;
continue;
}
if(s.equals(" ")) {
while(!stack.isEmpty()) { sb.append(stack.pop()); }
sb.append(s);
continue;
}
stack.push(s);
}
while(!stack.isEmpty()) { sb.append(stack.pop()); }
System.out.println(sb);
}
}