# C~K的班级

Problem Description

Input

Output

Sample Input
6
0001 MeiK 20 M
0001 MeiK 20 M
0002 sdk2 21 M
0002 sdk2 21 M
0002 sdk2 21 M
0000 blf2 22 F
Sample Output
3
0001 MeiK 20 M
0002 sdk2 21 M
0000 blf2 22 F

package pp;

import java.util.*;

class Person{
String son, name, sex;
int age;
public Person(String son, String name,  int age, String sex) {//顺序不能错
super();
this.son = son;
this.name = name;
this.age = age;
this.sex = sex;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + age;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((sex == null) ? 0 : sex.hashCode());
result = prime * result + ((son == null) ? 0 : son.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Person other = (Person) obj;
if (age != other.age)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (sex == null) {
if (other.sex != null)
return false;
} else if (!sex.equals(other.sex))
return false;
if (son == null) {
if (other.son != null)
return false;
} else if (!son.equals(other.son))
return false;
return true;
}
public String toString() {
return son + " " + name + " " + age + " " + sex;
}
}

public class Main {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()) {
int n = sc.nextInt();//几个人
List<Person>  list = new ArrayList<Person>();

while(n-- != 0) {
String son = sc.next();
String name = sc.next();
int age = sc.nextInt();
String sex = sc.next();
Person p = new Person(son, name, age, sex);
if(!list.contains(p))//排除重复元素
{
}
}

System.out.println(list.size());//个数
Iterator<Person> it = list.iterator();
while(it.hasNext()) {
System.out.println(it.next());
}

}
sc.close();
}
}