import java.io.*;
import java.util.*;

public class PurgeDupes
{
	public static void main( String args[] ) throws Exception
	{
		if ( args.length < 2 )
			die( "FATAL ERROR: must enter two filenames on command line.\n");

		//  READ IN BOTH SETS INTO PLAIN ARRAYS Of STRING

		String[] list1 = new String[1];
		String[] list2 = new String[1];
		int count1=0,count2=0;
		Scanner infile = new Scanner( new File(args[0]) );

		while (infile.hasNext())
		{		if (count1==list1.length)
					list1=upSize(list1);
				list1[count1++]=infile.next();
		}
		infile.close();


		infile = new Scanner( new File(args[1]) );
		while (infile.hasNext())
		{		if (count2==list2.length)
					list2=upSize(list2);
				list2[count2++]=infile.next();
		}
		infile.close();

		list1 = trim( list1, count1 ); // trim off the extra blank cells at end
		printList( "original list1: ", list1 );
		count1 = purgeDupes( list1 );  // returns the number of unique elements remaining after purging duplicates
		list1 = trim( list1, count1 ); // trim off the dupes stuff at end
		printList( "purged list1:   ", list1 );

		list2 = trim( list2, count2 ); // trim off the extra blank cells at end
		printList( "original list2: ", list2 );
		count2 = purgeDupes( list2 );  // returns the number of unique elements remaining after purging dulicates
		list2 = trim( list2, count2 ); // trim off the dupes stuff at end
		printList( "purged list2:   ", list2 );

	} // END MAIN

	static void die( String errMsg )
	{
		System.out.println( errMsg );
		System.exit(0); // kills program
	}
	static void printList( String caption, String[] list )
	{	System.out.print( caption );
		for( String word : list )
			System.out.print( word + " " );
		System.out.println();
	}
	static String[] upSize( String[] arr )
	{
		return null;   // DO NOT USE System.arraycopy IN OTHER REGULAR ASSIGNMENTS
	}

	static String[] trim( String[] arr, int count )
	{  	return null;   // DO NOT USE System.arraycopy IN OTHER REGULAR ASSIGNMENTS

	}
	// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
	// Y  O  U     F  I  L  L    I  N     T  H  I  S     M E  T  H  O  D    B  E  L  O  W
	// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

	// AFTER PURGING THE DUPES RETURN THE NEW COUNT OF UNIQE ELEMENTS
	static int purgeDupes( String[] list )
	{
		int newCntAfterPurge=0;
		// remove the dupe elements keep all values in original order but with gaps closed
		// all values packed tight to the front
		return newCntAfterPurge=0;

	}
} // EOF