P15886 [HackerEarth] Somnath is supposed to submit an assignment for his semester, but The Code Goddess cursed his keyboard. While typing the “HOME” and “END” keys gets pressed internally in a random manner.
普及-
题目描述

Somnath is supposed to submit an assignment for his semester, but The Code Goddess cursed his keyboard. While typing the “HOME” and “END” keys gets pressed internally in a random manner.
Since Somnath is in a hurry and he couldn't rectify his assignment. Can you help him with recovering the original text?

Input Format
The first line consists of a single integer T.
Next T lines contains a single string S in each line containing any alphabets and underscores (no spaces) and two special symbols “<” indicating HOME button is pressed and “>” indicating END button is pressed.

Output Format
For each string S output a single line containing the rectified text.

Constraints

1 ≤ T ≤ 10^5
1 ≤ |S| ≤ 1000

SAMPLE INPUT
2
even_debug<Do_you>_bro
_beautiful_versions
>of_<_perfection_only>brokenness<There_is_no

SAMPLE OUTPUT
Do_you_even_debug_bro
There_is_no_perfection_only_beautiful_versions_of_brokenness

输入格式

见题面

输出格式

见题面

样例输入
10 B>_ >_>b >>Qvb___z_>m_<<<_t>W>_>mXrv_><s>>_>>__>>f_>>ZV><>>>__Wq>__ kj>Ah_ <<ZvG<<<>i<<><<<o<<bc<<S><_R_D>><<X><gZ<ma_<<< CQq<_<EI_<>>_OrI>a>v<l_>> <A<Q>A_o>_><<>Q<><<>_<_<<><J_l__>>z<_>><y<W_<<<<p<_<>>b_>><<_T<<Kd<C<<_L<<__x<<> N<t>>k><ma>_<>>f_u<>v<<<A_<IG<>kxWl<<>_l><kaV<f<u___y_h<<R>Kn<Kg>Ihu_ikiDYcA<<VMAcmq<e<><<b>ON<R<Nn X_u >H>C<<<<iZ<iQ<><<<<v_G<C__<<Ms<>X<<<
样例输出
B_ _b s_tQvb___z_m_W_mXrv____f_ZV__Wq__ kjAh_ ma_gZX_R_DSbcoZvGi l_EI__CQq_OrIav __x_LCKd_T_pW_y_J_l___QAA_o_Q_zb_ NnRbeVMAcmqKgRu___y_hfkaVIGA_matNk_f_uvkxWl_lKnIhu_ikiDYcAON X_u MsC__v_GiQiZHCX