#!/usr/bin/env python3

import random
import sys

def generate_etude(line):
    words = line.split()
    i = 0
    while i < len(words):
        # Randomly choose a threshold for the length of the segment
        threshold = random.randint(20, 70)
        result = ""
        # Accumulate words until the threshold is reached or all words are
        # exhausted
        while len(result) < threshold and i < len(words):
            result += " " + words[i]
            i += 1
        result = result[1:]  # Remove leading space
        print(result)

        # Get indices of non-space characters in the result
        nonspaces = [index for index, char in enumerate(result)
                     if not char.isspace()]

        # Create a list to mark the positions for annotation
        marks = [" "] * len(result)

        # Randomly pick positions for annotation (one in every ten non-space
        # characters)
        for index, pick in enumerate(random.sample(nonspaces,
                                                   min(len(result) // 10,
                                                       len(nonspaces)))):
            marks[pick] = chr(index + ord('1'))  # Convert index to character

        print(''.join(marks).rstrip())  # Print annotations

def main():
    # Process each line from standard input
    for line in sys.stdin:
        generate_etude(line.strip())

if __name__ == '__main__':
    main()
