#!/usr/bin/python
# Author: Ivan Kazmenko (gassa@mail.ru)
# Answer shortener for problem statement
# For the problem revolving-lasers [0197]
# Usage: feed answer file to standard input
import sys, re

for s in sys.stdin:
	s = s.strip ()
	s = re.sub ('(55555+)', lambda x:
	  '\\textit{555..(' + str (len (x.group (1))) + ')..55}', s)
	sys.stdout.write ('{0}\n'.format (s))
