class ShortInputException(Exception): def __init__(self, length, atleast):
Exception.__init__(self)
self.length = length
self.atleast = atleast
try:
text = input() if len(text) < 3:
raise ShortInputException(len(text), 3) # Other work can continue as usual here
except EOFError:
print()
except ShortInputException as ex:
print(\
.format(ex.length, ex.atleast)) else:
print()