Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.HashSet;
- class Student {
- String name;
- Student(String name) {
- this.name = name;
- StudentGroup.set.add(this.name);
- }
- }
- class StudentGroup {
- public static HashSet<String> set = new HashSet<>();
- }
- public class Main {
- public static void main(String[] args) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- String input = null;
- while (!(input =reader.readLine()).equals("End")) {
- Student student = new Student(input);
- }
- System.out.println(StudentGroup.set.size());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement