import java.io.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

// Ce programme trouve (sur stdin) et indique (sur stdout) toutes les
// occurrences d'un motif (specifie sur la ligne de commande). Il
// indique aussi les occurrences multiples sur une meme ligne.

public class Occurrences {

    
    public static void main( String[] args ) throws IOException {

	BufferedReader input = new BufferedReader( new InputStreamReader(System.in) );
	
	Pattern patron = Pattern.compile( args[0] );

	int numLigne = 0;
	String ligne;
	while ( ( ligne = input.readLine()) != null ) {
	    numLigne += 1;
	    Matcher matcher = patron.matcher( ligne );
	    while ( matcher.find() ) {
		// La ligne contient le patron: on trouve toutes les occurrences.
		String motifTrouve = matcher.group();
		int debut = matcher.start();
		int fin = matcher.end();
		System.out.println( "Motif trouve a la ligne " + numLigne + 
				    " position " + debut + " a " + fin +
				    " : \"" + motifTrouve + "\"" );
	    }
	}
    }
}
