杭電hdu2072

wenchi哦發表於2020-10-10
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String []args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext())
        {
            String a=sc.nextLine();
            String b[]=a.split(" ");
            if(a.contains("#"))
                break;
            List list=new ArrayList();
            for(int i=0;i<b.length;i++)
            {
                if(!list.contains(b[i]))
                    list.add(b[i]);
            }
            if(list.contains(""))
            {
                System.out.println(list.size()-1);
            }
            else
                System.out.println(list.size());
        }
    }

}

相關文章