def solve(s): new = s[::-1] i = 0 stack = [] while i<len(s) and not stack: if new[i]==']' and i+6<len(s) and new[i:i+6]==']gmi\[': i += 6 while i<len(s): if new[i]==']' and i+5<len(s) and new[i:i+5]==']gmi[': break stack.append(new[i]) i += 1 i += 1 if i<len(s): return '[img]'+''.join(stack)[::-1]+'[\img]' return 'null' if __name__=='__main__': s = raw_input().strip() print solve(s)