import java.util.*;
import javax.swing.JOptionPane;

public class TreeTest1A 
{ 
  public static String print(Collection c)
  {
    String s="";
    Iterator i=c.iterator();
    int j=1;
    while(i.hasNext()) {s+="sıra = "+j+" "+i.next()+"\n";j++;}
    return s;
  }
  
  public static String[] enterStringarray(String s)
     {
     Locale tr=new Locale("TR");
	 String s1=JOptionPane.showInputDialog(s);        
     StringTokenizer token=new StringTokenizer(s1);
     int n=token.countTokens()-1;
     int m=n+1;
     String a[]=new String[m];
     int j=0;           
     while(token.hasMoreTokens())
     {a[j++]=token.nextToken();}
     return a;
     }
  public static void main(String args[]) 
  { 
  while(true)
  {	  
  String x[]=enterStringarray("kelimeleri aralarında bir boşluk bırakarak giriniz");
  TreeSet<String> tree=new TreeSet<String>(); 
  int n=x.length; 
  System.out.println("sıraya koyulmuş kelimeler"); 
  for(int i=0;i<n;i++)
  tree.add(x[i]); 
  String s=print(tree);
  System.out.print(s);  
  }
  } 
}
