use std::io::{stdin, BufRead, BufReader};
fn main() {
let mut stdin = BufReader::new(stdin());
let mut cur_line = String::new();
stdin.read_line(&mut cur_line).unwrap();
if cur_line.trim() == "1" {
cur_line.clear();
stdin.read_line(&mut cur_line).unwrap();
let k: usize = cur_line.trim().parse().unwrap();
for _ in 0..k {
let mut input = String::new();
stdin.read_line(&mut input).unwrap();
input = input.trim().into();
for cp in input.bytes() {
let c = cp - b'a';
print_base_3(c / 12);
print!("{}", (c % 12) / 6);
print_base_3((c % 6) / 2);
print!("{}", c % 2);
}
println!("_");
}
} else {
let mut input = String::new();
stdin.read_line(&mut input).unwrap();
input = input.trim().into();
let mut output = Vec::new();
let mut cs = input.chars().collect::<Vec<_>>();
while !cs.is_empty() {
let mut cur = String::new();
let mut i = 3;
while cs.get(i).unwrap_or(&'_') != &'_' {
let c = 12 * base_3_to_int(cs[i])
+ 6 * base_2_to_int(cs[i + 1])
+ 2 * base_3_to_int(cs[i + 2])
+ base_2_to_int(cs[i + 3]);
cur.push((c + b'a') as char);
i += 4;
}
cs = cs[i..].into();
output.push(cur);
}
println!("{}", output.len());
for s in output {
println!("{}", s);
}
}
}
fn print_base_3(x: u8) {
match x {
0 => print!("0"),
1 => print!("1"),
2 => print!("_"),
_ => (),
}
}
fn base_2_to_int(x: char) -> u8 {
match x {
'0' => 0,
'1' => 1,
_ => panic!(),
}
}
fn base_3_to_int(x: char) -> u8 {
match x {
'0' => 0,
'1' => 1,
'_' => 2,
_ => panic!(),
}
}