牛客网编程练习之网易2017校招题:下厨房
水...
AC代码:
import java.util.Collections; import java.util.HashSet; import java.util.Scanner; import java.util.Set; /** * @author CC11001100 */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Set<String> ans = new HashSet<>(); while(sc.hasNextLine()){ Collections.addAll(ans, sc.nextLine().split("\\s+")); } System.out.println(ans.size()); } }