#include <cstdio>
#define mlen 1001
char s[mlen], a[mlen], res[mlen];
int an = 0, rn = 0, bad = 0;
char p[256];
int main()
{
p[')'] = '(';
p['}'] = '{';
p[']'] = '[';
p['>'] = '<';
freopen("bracket.in", "r", stdin);
freopen("bracket.out", "w", stdout);
scanf("%s", s);
for (int i = 0; s[i]; i++)
if (s[i] == '(' || s[i] == '[' || s[i] == '{' || s[i] == '<')
a[an++] = s[i];
else if (s[i] == ')' || s[i] == ']' || s[i] == '}' || s[i] == '>')
if (an == 0 || p[s[i]] != a[an - 1])
bad = 1;
else
an--;
else
res[rn++] = s[i];
res[rn] = 0;
if (bad || an)
puts("-");
else
puts(res);
return 0;
}