Fork me on GitHub

牛客网编程练习之网易2017校招题:下厨房

image

 

水...

 

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());

	}

}

 

 

题目来源: https://www.nowcoder.com/practice/ca5c9ba9ebac4fd5ae9ba46114b0f476?tpId=85&tqId=29832&tPage=1&rp=1&ru=/ta/2017test&qru=/ta/2017test/question-ranking

posted @ 2017-12-10 18:35  CC11001100  阅读(203)  评论(0编辑  收藏  举报