#include <iostream>
using namespace std;
int main()
{
string s;
cin >> s;
s += ',';
for (int i = 0, j = 0; i < s.size(); i++)
{
if (s[i] == ',')
{
string str = s.substr(j, i - j);
j = i + 1;
bool a = false, b = false, c = false, d = false, e = false;
for (int p = 0; p < str.size(); p++)
{
if (string("!@#$").find(str[p]) != string::npos)
b = true;
else if (str[p] >= '0' && str[p] <= '9')
c = true;
else if (str[p] >= 'a' && str[p] <= 'z')
d = true;
else if (str[p] >= 'A' && str[p] <= 'Z')
e = true;
else
a = true;
}
if (c + d + e < 2 || !b || a || str.size() < 6 || str.size() > 12)
continue;
cout << str << endl;
}
}
return 0;
}