def opt_str(char, acc):
opts = []
char_num = ord(char)
opts.append(str(char_num))
if 0 < char_num - acc < 10:
opts.append('+' + str(char_num - acc))
if 0 < acc - char_num < 10:
opts.append('-' + str(acc - char_num))
if char_num - acc == 1:
opts.append('^')
if acc - char_num == 1:
opts.append('v')
if acc == char_num:
opts.append('')
if acc and char_num % acc == 0:
opts.append('*' + str(char_num//acc))
try:
if acc // (acc // char_num) == char_num:
opts.append('/' + str(acc // char_num))
except:
pass
return [opt for opt in opts if len(opt) == len(min(opts, key=len))]
acc = 0
result = []
pos = 0
in_str = """zero
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
one and twenty
two and twenty
three and twenty
four and twenty
five and twenty
six and twenty
seven and twenty
eight and twenty
nine and twenty
thirty
one and thirty
two and thirty
three and thirty
four and thirty
five and thirty
six and thirty
seven and thirty
eight and thirty
nine and thirty
forty
one and forty
two and forty
three and forty
four and forty
five and forty
six and forty
seven and forty
eight and forty
nine and forty
half third times twenty
one and half third times twenty
two and half third times twenty
three and half third times twenty
four and half third times twenty
five and half third times twenty
six and half third times twenty
seven and half third times twenty
eight and half third times twenty
nine and half third times twenty
three times twenty
one and three times twenty
two and three times twenty
three and three times twenty
four and three times twenty
five and three times twenty
six and three times twenty
seven and three times twenty
eight and three times twenty
nine and three times twenty
half fourth times twenty
one and half fourth times twenty
two and half fourth times twenty
three and half fourth times twenty
four and half fourth times twenty
five and half fourth times twenty
six and half fourth times twenty
seven and half fourth times twenty
eight and half fourth times twenty
nine and half fourth times twenty
four times twenty
one and four times twenty
two and four times twenty
three and four times twenty
four and four times twenty
five and four times twenty
six and four times twenty
seven and four times twenty
eight and four times twenty
nine and four times twenty
half fifth times twenty
one and half fifth times twenty
two and half fifth times twenty
three and half fifth times twenty
four and half fifth times twenty
five and half fifth times twenty
six and half fifth times twenty
seven and half fifth times twenty
eight and half fifth times twenty
nine and half fifth times twenty
one hundred"""
while pos < len(in_str):
i = in_str[pos]
pos += 1
if i in '0123456789':
if i != '0':
while pos < len(in_str) and in_str[pos] in '0123456789':
i += in_str[pos]
pos += 1
if i == str(acc):
result.append('o')
else:
result.append(i + 'o')
acc = int(i)
else:
opts = opt_str(i, acc)
result.append(opts[0] + 'a')
acc = ord(i)
print(len(''.join(result)))
print(''.join(result))