#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
if (t == 1) {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
cout << "_";
for (char c : s) {
int b = c - 'a';
for (int j = 0; j < 5; ++j) {
cout << !!(b & (1 << j));
}
}
cout << endl;
}
} else {
string s;
cin >> s;
s += "_";
string c;
cout << count(s.begin(), s.end(), '_') << endl;
for (char u : s) {
if (u == '_') {
string k;
for (int i = 0; i < (int) c.size(); i += 5) {
k.push_back(0);
for (int j = 0; j < 5; ++j) {
if (c[i + j] == '1') {
k.back() += 1 << j;
}
}
k.back() += 'a';
}
cout << k << endl;
c.clear();
} else {
c += u;
}
}
}
}