#include <bits/stdc++.h>
#include <sstream>
#include <vector>
using namespace std;
//11.27
int A = 0, B = 0, C = 0, D = 0, E = 0, wrong = 0, p = 0; //p是私有
bool isvalid_mask(string mask) {
int res[32];//存放掩码的二进制
for (int i = 0; i < 32; i++) res[i] = 0;
stringstream ss(mask);
string t;
int k = 1;
int j;
while (getline(ss, t, '.')) {
int num = stoi(t);
j = 1;
while (num > 0) {
res[8 * k - j] = num % 2;
num /= 2;
j++;
}
k++;
}
//检查res
//全是0,非法
if (res[0] == 0) return false;
for (int i = 1; i < 32; i++) {
if (res[i] == 0) {
for (int ii = i + 1; ii < 32; ii++) {
// cout<<"kkk";
if (res[ii] == 1) return false;
}
}
}
if (res[31] == 1) return false; //全是1,非法
return true;
}
void check(string ip) {
stringstream ss(ip);
string t;
vector<string> my_ip;
while (getline(ss, t, '.')) {
if (t.empty() || stoi(t) > 255) { //不合法的ip
wrong++;
return;
}
my_ip.push_back(t);
}
if (stoi(my_ip[0]) >= 1 && stoi(my_ip[0]) <= 126) A++;
if (stoi(my_ip[0]) >= 128 && stoi(my_ip[0]) <= 191) B++;
if (stoi(my_ip[0]) >= 192 && stoi(my_ip[0]) <= 223) C++;
if (stoi(my_ip[0]) >= 224 && stoi(my_ip[0]) <= 239) D++;
if (stoi(my_ip[0]) >= 240 && stoi(my_ip[0]) <= 255) E++;
if (stoi(my_ip[0]) == 10) p++;
if (stoi(my_ip[0]) == 172 && (stoi(my_ip[1]) == 16 ||
stoi(my_ip[1]) == 31)) p++;
if (stoi(my_ip[0]) == 192 && (stoi(my_ip[1]) == 168)) p++;
return;
}
bool isnone(string ip)
{
stringstream ss(ip);
string t;
vector<string> ipp;
while(getline(ss,t,'.'))
{
if(!t.empty()) ipp.push_back(t);
}
if(ipp.size()==4&&(stoi(ipp[0])==0||stoi(ipp[0])==127)) return true;
return false;
}
int main() {
string s;
while (getline(cin, s)) {
stringstream ss(s);
string ip, mask, t;
int c = 1;
while (getline(ss, t, '~')) {
if (c == 1) ip = t;
else mask = t;
c++;
}
//
if(isnone(ip)) continue;
//检查mask
if (isvalid_mask(mask) == 0) {
//掩码非法
wrong++;
continue;
}
//检查ip
check(ip);
}
cout << A << " " << B << " " << C << " " << D << " " << E << " " << wrong << " "
<< p << endl;
}
// 64 位输出请用 printf("%lld")