Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6. import java.util.HashSet;
  7.  
  8. class Student {
  9.     String name;
  10.  
  11.     Student(String name) {
  12.         this.name = name;
  13.         StudentGroup.set.add(this.name);
  14.     }
  15. }
  16.  
  17. class StudentGroup {
  18.     public static HashSet<String> set = new HashSet<>();
  19. }
  20.  
  21. public class Main {
  22.     public static void main(String[] args) throws IOException {
  23.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  24.  
  25.         String input = null;
  26.  
  27.         while (!(input =reader.readLine()).equals("End")) {
  28.             Student student = new Student(input);
  29.         }
  30.  
  31.         System.out.println(StudentGroup.set.size());
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement