Java Person Teacher 3#9660

Java Person Teacher 3

1 second
128 megabytes
Very easy

Implement a class Person.

Implement a class Teacher that extends Person.

class Person 
{
  protected String Surname, Name;
  protected int Age;
  Person(String Surname, String Name, int Age) // Constructor
  public String toString() // Print Surname Name Age
}

class Teacher extends Person 
{
  protected String Subject;
  protected int Salary;
  Teacher(String Surname, String Name, int Age, String Subject, int Salary) // Constructor
  public String toString() // Print Surname Name Age Subject Salary
}

class ListOfPeople
{
  ArrayList<Person> a = new ArrayList<Person>(); 
  public void add(Person p) // Add person p to array list
  public int size() // Return size of array list
  public String toString() // Print people in array list. Each person print in a separate line
  public ListOfPeople getTeachers() // Return the list of Teachers only
  public int GetNumberOfTeachers() // Return the number of Teachers in the list
  public ListOfPeople getNotTeachers()  // Return the list of People who are not Teachers
  public int GetNumberOfNotTeachers() // Return the number of People who are not Teachers in the list
}

List of people will be created:

ListOfPeople list = new ListOfPeople();

Input data will be added to the list. The number and the list of Teachers will be printed

System.out.println(list.GetNumberOfTeachers());
System.out.print(list.getTeachers());

The number and the list of People who are not Teachers will be printed

System.out.println(list.GetNumberOfNotTeachers());
System.out.print(list.getNotTeachers());

Input

Each line contains one of two types of people in the next format:

  • Person Surname Name Age

  • Teacher Surname Name Age Subject Salary

Output

In the first line print the number of Teachers. In the next lines print the data for Teachers.Then print the number of People who are not Teachers. In the next lines print the data for People who are not Teachers.

Examples

Example 1

Loading
Loading