Printing Words

Problem

Given an input text file as in the example below

Write a script that prints the output below

Solution

Each line in the file contains a word and a list of positions at which the word is repeated in the printed output. Here is a python implementation:

Add a Comment

Your email address will not be published. Required fields are marked *