import java.io.File;
import java.util.Scanner;
public class Main {

	public static boolean isIn(String s,LinkedList<String>[] list){
		for(int i=0;i<list[s.length()-1].getSize();++i){
			if(s.equalsIgnoreCase(list[s.length()-1].getData(i)))
				return true;
		}
		return false;
	}
	
	public static void main(String[] args) {
		
		File f;
		String s="";
		Scanner in;
		LinkedList<String>[] list = new LinkedList[11];
		
		for(int i=0;i<list.length;++i){
			list[i]=new LinkedList<>();
		}

		try{
			f=new File("Info.txt");
		    in = new Scanner(f);
			
			while(in.hasNext()){
				s=in.next();
				if(!isIn(s, list)){
					list[s.length()-1].addInsertion(s);
				}
				s="";
			}
		}
		catch(Exception e){
			System.out.println("The File Not Found !!");
			System.exit(0);
		}
		
		for(int i=0;i<list.length;++i){
			if(list[i].getSize()!=0){
				list[i].printReverse();;
			}
				
		}
		

	}

}
