import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
 
 
public class Main {
    public static void main(String[] args) {
        System.out.println("Put the product, use '/' for argument");
        ArrayList<Product> list = new ArrayList<>();
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        try {
            int k = 0;
            while (true) {
                String s = read.readLine();
                if ((s.length() == 0) || (s.matches("[0-9]"))) {
                    System.out.println("Put the string only");
                    break;
                }
                String parts[] = s.split("/");
                if (parts[0].equals("Apple")) {
                    list.add(new Apple(parts[1]));
                }
            }
        } catch (IOException e) {
            System.out.println(e.getMessage());
        }
        for (int i = 0; i < list.size(); i++) {
            int k = 0;
            if (list.get(i) instanceof Apple) {
                Apple a = (Apple) list.get(i);
                {
                    for (int j = 0; j < list.size(); j++) {
                        if (list.get(j) instanceof Apple) {
                            Apple b = (Apple) list.get(j);
                            if(a.getSize().equals(b.getSize())) {
                                k++;
                              list.remove(j);
                                list.add(j, null);
                            }
                        }
                    }
                    System.out.println("In this month  had eaten " + k + " apple a " + a.getSize() + " size");
                }
            }
        }
    }
}