//需要注意的几点: //1.先做无效IP判断,不计入非法IP或者非法子网掩码; //2.再判断子网掩码是否合法,若非法,则与之成组的合法IP也不计入,若合法,才有必要去判断IP是否合法; //3.再判断IP地址是否合法; //4.在确定以上IP地址有效、子网掩码正确以及IP地址合法的情况下,再判断IP地址属于那种类型。

import java.util.*;

public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String isSubnet = "1+0+"; int countA = 0, countB = 0, countC = 0, countD = 0, countE = 0; int countWrong = 0, countPrivate = 0; while (scan.hasNextLine()) { String input = scan.nextLine(); String input1 = input.split("")[0]; String input2 = input.split("")[1]; String[] input1s = input1.split("\."); String[] input2s = input2.split("\."); boolean isIgnored = (input1s[0].equals("0")) || (input1s[0].equals("127"));

        if (isIgnored) continue;
        //judge Subnet Mask
            String input22 = "";
            for (String item : input2s) {
                int num = Integer.parseInt(item);
                String num2 = Integer.toBinaryString(num);
                while(num2.length()<8) num2="0"+num2;
                input22 += num2;
            }
            if (!input22.matches(isSubnet)) {

// System.out.println(input2); countWrong++; continue; }

            //judge IP address

            boolean isDigit = true;
            boolean isLessThan255 = true;
            for (String item : input1s) {
                if (!item.matches("\\d{1,3}"))  isDigit = false;
                if (isDigit) {
                    if (Integer.parseInt(item) > 255) isLessThan255 = false;
                }

            }
            //count
            if (isDigit) {
                if (isLessThan255) {
                    int a = Integer.parseInt(input1s[0]);
                    int b = Integer.parseInt(input1s[1]);
                    if (a <= 126 ) {
                        countA++;
                        if (a == 10) countPrivate++;
                    } else if (a <= 191) {
                        countB++;
                        if (a == 172 && b >= 16 && b <= 31) countPrivate++;
                    } else if (a <= 223) {
                        countC++;
                        if (a == 192 && b == 168) countPrivate++;
                    } else if (a <= 239) {
                        countD++;
                    } else if ( a <= 255) {
                        countE++;
                    }
                } else {
                    countWrong++;
                }
            } else {
                countWrong++;
            }

        
    }
    System.out.println(countA + " " + countB + " " + countC + " " + countD + " " +
                       countE + " " + countWrong + " " + countPrivate + " ");
}

}