#include <iostream>
#include <string>

using namespace std;

bool check(string str)
{
  for (int i = 0; i < int(str.size()); i++) {
    // 跳过合法的情况
    if (str[i] >= 'A' && str[i] <= 'Z') {
      continue;
    }
    if (str[i] >= 'a' && str[i] <= 'z') {
      continue;
    }
    if (str[i] == '!' || str[i] == '@' || str[i] == '#' || str[i] == '$') {
      continue;
    }
    if (str[i] >= '0' && str[i] <= '9') {
      continue;
    }
    return false;
  }
  return true;
}

bool check2(string str)
{
  int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
  for (int i = 0; i < int(str.size()); i++) {
    if (str[i] >= 'A' && str[i] <= 'Z') {
      c1 = 1;
    }
    if (str[i] >= 'a' && str[i] <= 'z') {
      c2 = 1;
    }
    if (str[i] == '!' || str[i] == '@' || str[i] == '#' || str[i] == '$') {
      c4 = 1;
    }
    if (str[i] >= '0' && str[i] <= '9') {
      c3 = 1;
    }
  }
  if (c1 + c2 + c3 >= 2 && c4 == 1) {
    return true;
  }
  else {
    return false;
  }
}

int main()
{
  string a;
  cin >> a;
  a += ",";

  int n = a.size(); // 1-index

  string str = "";
  for (int i = 0; i < n; i++) {
    // 0 分割字符串
    if (a[i] != ',') {
      str += a[i];
    }
    else {
      // 检查长度是否在 6 到 12 之间
      int m    = str.size();
      bool ok1 = (m >= 6 && m <= 12);
      // 检查字符内容是否合法
      bool ok2 = check(str);
      // 检查种类是否合格
      bool ok3 = check2(str);
      if (ok1 && ok2 && ok3) {
        cout << str << '\n';
      }

      str = "";
    }
  }
}