1 #include <iostream>
   2 #include <sstream>
   3 #include <string>
   4 #include <algorithm>
   5 #include <vector>
   6 #include <cmath>
   7 #include <map>
   8 using namespace std;
   9 
  10 #define GI ({int _t; scanf("%d", &_t); _t;})
  11 #define FOR(i, a, b) for (int i=a; i<b; i++)
  12 #define REP(i, a) FOR(i, 0, a)
  13 template<class T> string toString(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();}
  14 int toInt(string s){int r=0;istringstream sin(s);sin>>r;return r;}
  15 #define DBG(x) cout << #x << "::" << x << endl;
  16 #define DBGV(_v) { REP(_i, _v.size()) { cout << _v[_i] << "\t";} cout << endl;}
  17 #define MAX 2001
  18 #define sz size()
  19 
  20 int main() {
  21 	int kases = GI;
  22 	vector <int> primes;
  23 	FOR(i, 2, MAX+1) {
  24 		int lim = sqrt(i)+1;
  25 		bool prime = true;
  26 		FOR(j, 2, lim) {
  27 			if (i%j==0) {
  28 				prime = false;
  29 				break;
  30 			}
  31 		}
  32 		if (prime == true) {
  33 			primes.push_back(i);
  34 		}
  35 	}
  36 
  37 	//DBGV(primes);
  38 	string s;
  39 	REP(kase, kases) {
  40 		printf("Case %d: ", kase+1);
  41 		bool found = false;
  42 		map <char, int> cnt;
  43 		cin >> s;
  44 		REP(i, s.sz) {
  45 			cnt[s[i]]++;
  46 		}
  47 		for(map<char,int>::iterator it = cnt.begin(); it!=cnt.end(); it++) {
  48 			if (binary_search(primes.begin(), primes.end(), it->second)) {
  49 				printf("%c", it->first);
  50 				found = true;
  51 			}
  52 		}
  53 		if (found == false) printf("empty");
  54 		printf("\n");
  55 	}
  56 	return 0;
  57 }