Problem:
博士の暗号
博  士 : ?D-C'KOPUA
ピーター : どうしたんですか、デビッド博士? わけのわからないことを叫ぶのにはもう慣れましたが、
        今日は文章にすらなっていませんよ。
博  士 : ほれ。
ピーター : なんですか? この表は......ああ、予選の問題にこんなのがありました。表を使って文字を置き換え
       ると文字数が減るんですよね。まさか予選と本選で同じ問題を出して手を抜こうって気じゃないでし
       ょうね。
博  士 : 逆じゃよ。
ピーター : 逆? なるほど、今度は短くした文字列を元に戻そうって問題ですか。ということは「?D-C'KOPUA」の
      文字を、この表を使って「文字」から「符号」に置きかえるんですね......できましたよ。
11111 00011 11101 00010 11110 01010 01110 01111 10100 00000
博  士 : うむ。次はこれじゃ。
ピーター : そうそう、こんな表もありましたね。これを逆に使うんだから「符号」から「文字」に置き換えればいい
          んですね。でも、最初は「11111」ですが表にありませんよ?
博     士 : そういうときは、もっと短くするか、後ろとつなげるかしてみるのだよ。
ピ ー タ ー : じゃあ短くして......あ、 「111」ならあります。じゃあ最初は「P」ですね。そうすると残りは「11」ですが、
            これはぴったり合うのがないから次の「00011」から 1 文字借りて「110」にすればいいんですね。
博     士 : そうそう。つまり「E」だね。
ピ ー タ ー : それで残るのが「0011」なので、これも次から借りて「00111」にして「T」と......。全部できました。最
          後の「0000」は捨てちゃえばいいんですよね?
博     士 : そうじゃ、よろしい。次はこれじゃ。
?D-C'?-C'-LMGZN?FNJKN- WEYN?P'QMRWLPZLKKTPOVRGDI
博     士 : さらにこれじゃ。
?P'QNPY?IXX?IXXK.BI -G?R'RPP'RPOVWDMW?SWUVG'-LCMGQ
博     士 : 仕上げにこうじゃ。
?P'QMDUEQ GADKOQ ?SWUVG'-LCMG?X?IGX,PUL.?UL.VNQQI
ピ ー タ ー : しっかし面倒だなあ。博士、今度は自分でプログラムを作って下さいよ。
ということで、博士のかわりに、上の文章を置き換えるプログラムを作成してください。
Input
複数のデータセットが与えられます。各データセットとして、１つの文字列（表に含まれる文字からなる 200 文字以下の文字列）が１行に与えられます。入力の終わりまで処理してください。データセットの数は 200 を超えません。
Output
各データセットごとに、変換後の文字列を１行に出力してください。
Sample Input
?D-C'KOPUA
Output for the Sample Input
PETER POTTER

Submitted solutions:

code_snippet: #include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
    for(string s;getline(cin,s);){
        string st;
        for(ll i=0;i<s.size();i++){
            string str="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
            ll num=str.find(s[i]);
            for(ll j=4;j>=0;j--){
                st+=!!(num&1<<j)+'0';
            }
        }
        string t;
        for(ll i=0;i<st.size();i++){
            t+=st[i];
            string v[]={"101","000000","000011","10010001","010001","000001","100101","10011010","0101","0001","110","01001","10011011","010000","0111","10011000","0110","00100","10011001","10011110","00101","111","10011111","1000","00110","00111","10011100","10011101","000010","10010010","10010011","10010000"};
            const char *c=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            ll num=find(v,v+32,t)-v;
            if(num!=32){
                cout<<c[num];
                t.clear();
            }
        }
        cout<<endl;
    }
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3128
final_rank: 17

code_snippet: #include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    map<char, string> m;
    map<string, char> minv;
    m[' '] = "101";
    m['\''] = "000000";
    m[','] = "000011";
    m['-'] = "10010001";
    m['.'] = "010001";
    m['?'] = "000001";
    m['A'] = "100101";
    m['B'] = "10011010";
    m['C'] = "0101";
    m['D'] = "0001";
    m['E'] = "110";
    m['F'] = "01001";
    m['G'] = "10011011";
    m['H'] = "010000";
    m['I'] = "0111";
    m['J'] = "10011000";
    m['K'] = "0110";
    m['L'] = "00100";
    m['M'] = "10011001";
    m['N'] = "10011110";
    m['O'] = "00101";
    m['P'] = "111";
    m['Q'] = "10011111";
    m['R'] = "1000";
    m['S'] = "00110";
    m['T'] = "00111";
    m['U'] = "10011100";
    m['V'] = "10011101";
    m['W'] = "000010";
    m['X'] = "10010010";
    m['Y'] = "10010011";
    m['Z'] = "10010000";
    minv["00000"] = 'A';
    minv["00001"] = 'B';
    minv["00010"] = 'C';
    minv["00011"] = 'D';
    minv["00100"] = 'E';
    minv["00101"] = 'F';
    minv["00110"] = 'G';
    minv["00111"] = 'H';
    minv["01000"] = 'I';
    minv["01001"] = 'J';
    minv["01010"] = 'K';
    minv["01011"] = 'L';
    minv["01100"] = 'M';
    minv["01101"] = 'N';
    minv["01110"] = 'O';
    minv["01111"] = 'P';
    minv["10000"] = 'Q';
    minv["10001"] = 'R';
    minv["10010"] = 'S';
    minv["10011"] = 'T';
    minv["10100"] = 'U';
    minv["10101"] = 'V';
    minv["10110"] = 'W';
    minv["10111"] = 'X';
    minv["11000"] = 'Y';
    minv["11001"] = 'Z';
    minv["11010"] = ' ';
    minv["11011"] = '.';
    minv["11100"] = ',';
    minv["11101"] = '-';
    minv["11110"] = '\'';
    minv["11111"] = '?';
    string s;
    while(getline(cin, s)){
        string t;
        for (auto &&i : s) {
            for (auto &&j : minv) {
                if(j.second == i) t += j.first;
            }
        }
        string ans; int cur = 0;
        while(true){
            int ok = 0;
            for (auto &&i : m) {
                if(t.substr(cur, i.second.size()) == i.second){
                    ans += i.first;
                    ok = 1;
                    cur += i.second.size();
                    break;
                }
            }
            if(!ok) break;
        }
        cout << ans << "\n";
    }
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3196
final_rank: 19

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

stringstream ans;
stringstream tmp;
int len;
int i;
void search_code (string S, char a) {
    if (tmp.str() == S) {
        ans << a;
        len = 0;
        tmp.str("");
        tmp.clear(stringstream::goodbit);
    }
}

void input_code (char a) {
    //dump(i);
    tmp << a;
    i++;
    len++;
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    while(getline(cin, S)){
        tmp.str("");
        tmp.clear(stringstream::goodbit);
        ans.str("");
        ans.clear(stringstream::goodbit);
    i = 0;
    len = 0;

    // ??\???????????????????????°??????
    stringstream str;
    string Cstr;
    while (S[i] != '\0') {
        int tmp;
        if (S[i] >= 'A' && S[i] <= 'Z') tmp = S[i] - 'A';
        else if (S[i] == ' ') tmp = 26;
        else if (S[i] == '.') tmp = 27;
        else if (S[i] == ',') tmp = 28;
        else if (S[i] == '-') tmp = 29;
        else if (S[i] == '\'') tmp = 30;
        else if (S[i] == '?') tmp = 31;
        str << static_cast<bitset<5> >(tmp);
        i++;
    }
    Cstr = str.str();
    //dump(Cstr);

    i = 0;
    while (i < Cstr.length()) {
        //dump(ans.str());
        //dump(tmp.str());
        while (len < 3) {
            input_code(Cstr[i]);
        }
        //dump(tmp.str());
        //len == 3;
        search_code("101", ' ');
        search_code("110", 'E');
        search_code("111", 'P');
        if ((tmp.str()).length() != 0) input_code(Cstr[i]);
        else continue;

        //dump(tmp.str());
        //len == 4;
        search_code("0101", 'C');
        search_code("0001", 'D');
        search_code("0111", 'I');
        search_code("0110", 'K');
        search_code("1000", 'R');

        if ((tmp.str()).length() != 0) input_code(Cstr[i]);
        else continue;

        //dump(tmp.str());
        //len == 5;
        search_code("01001", 'F');
        search_code("00100", 'L');
        search_code("00101", 'O');
        search_code("00110", 'S');
        search_code("00111", 'T');

        if ((tmp.str()).length() != 0) input_code(Cstr[i]);
        else continue;

        //dump(tmp.str());
        //len == 6;
        search_code("000000", '\'');
        search_code("000011", ',');
        search_code("010001", '.');
        search_code("000001", '?');
        search_code("010000", 'H');
        search_code("000010", 'W');
        search_code("100101", 'A');

        if ((tmp.str()).length() != 0) {
            input_code(Cstr[i]);
            input_code(Cstr[i]);
        }
        else continue;

       //dump(tmp.str());
       //len == 8;
       search_code("10010001", '-');
       search_code("10011010", 'B');
       search_code("10011011", 'G');
       search_code("10011000", 'J');
       search_code("10011001", 'M');
       search_code("10011110", 'N');
       search_code("10011111", 'Q');
       search_code("10011100", 'U');
       search_code("10011101", 'V');
       search_code("10010010", 'X');
       search_code("10010011", 'Y');
       search_code("10010000", 'Z');

       if ((tmp.str()).length() != 0) input_code(Cstr[i]);
       else continue;
    }

    //cout << tmp.str() << endl;
    cout << ans.str() << endl;
    }
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3104
final_rank: 16

code_snippet: #include <string>
#include <vector>
#include <iostream>
using namespace std;
string e = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
vector<string> s1 = {
	"100101", "10011010", "0101", "0001", "110",
	"01001", "10011011", "010000", "0111", "10011000",
	"0110", "00100", "10011001", "10011110", "00101",
	"111", "10011111", "1000", "00110", "00111",
	"10011100", "10011101", "000010", "10010010", "10010011",
	"10010000", "101", "010001", "000011", "10010001",
	"000000", "000001"
};
vector<string> s2 = {
	"00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111", "01000", "01001",
	"01010", "01011", "01100", "01101", "01110", "01111", "10000", "10001", "10010", "10011",
	"10100", "10101", "10110", "10111", "11000", "11001", "11010", "11011", "11100", "11101",
	"11110", "11111"
};
string s;
int main() {
	while (s = "", getline(cin, s)) {
		string t;
		for (int i = 0; i < s.size(); i++) {
			for (int j = 0; j < e.size(); j++) {
				if (s[i] == e[j]) t += s2[j];
			}
		}
		string ret = "";
		for (int i = 0; i < t.size();) {
			bool flag = false;
			for (int j = 0; j < e.size(); j++) {
				if (t.substr(i, s1[j].size()) == s1[j]) {
					ret += e[j]; i += s1[j].size(); flag = true;
					break;
				}
			}
			if (!flag) break;
		}
		cout << ret << endl;
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3136
final_rank: 18

code_snippet: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

#define eadd(a,b) encode[(b)] = (a)
#define dadd(a,b) decode[(b)] = (a)

map<string, char> encode;
map<char, string> decode;

void solve111(string s) {
    string t = "";
    REP(i,s.size()) {
        t += decode[s[i]];
    }
    string ans = "";
    while (t.size()) {
        string c = "";
        c += t[0];
        c += t[1];
        c += t[2];
        int i = 3;
        while (encode.find(c) == encode.end()) {
            if (i >= t.size()) {
                c = "end";
                t = "";
                break;
            }
            c += t[i++];
        }
        if (c != "end") {
            ans += encode[c];
            REP(j,i) {
                t.erase(t.begin());
            }
        }
    }
    cout << ans << endl;
}

int main() {
    eadd(' ',"101");
    eadd('\'',"000000");
    eadd(',',"000011");
    eadd('-',"10010001");
    eadd('.',"010001");
    eadd('?',"000001");
    eadd('A',"100101");
    eadd('B',"10011010");
    eadd('C',"0101");
    eadd('D',"0001");
    eadd('E',"110");
    eadd('F',"01001");
    eadd('G',"10011011");
    eadd('H',"010000");
    eadd('I',"0111");
    eadd('J',"10011000");
    eadd('K',"0110");
    eadd('L',"00100");
    eadd('M',"10011001");
    eadd('N',"10011110");
    eadd('O',"00101");
    eadd('P',"111");
    eadd('Q',"10011111");
    eadd('R',"1000");
    eadd('S',"00110");
    eadd('T',"00111");
    eadd('U',"10011100");
    eadd('V',"10011101");
    eadd('W',"000010");
    eadd('X',"10010010");
    eadd('Y',"10010011");
    eadd('Z',"10010000");
    
    dadd("00000",'A');
    dadd("00001",'B');
    dadd("00010",'C');
    dadd("00011",'D');
    dadd("00100",'E');
    dadd("00101",'F');
    dadd("00110",'G');
    dadd("00111",'H');
    dadd("01000",'I');
    dadd("01001",'J');
    dadd("01010",'K');
    dadd("01011",'L');
    dadd("01100",'M');
    dadd("01101",'N');
    dadd("01110",'O');
    dadd("01111",'P');
    dadd("10000",'Q');
    dadd("10001",'R');
    dadd("10010",'S');
    dadd("10011",'T');
    dadd("10100",'U');
    dadd("10101",'V');
    dadd("10110",'W');
    dadd("10111",'X');
    dadd("11000",'Y');
    dadd("11001",'Z');
    dadd("11010",' ');
    dadd("11011",'.');
    dadd("11100",',');
    dadd("11101",'-');
    dadd("11110",'\'');
    dadd("11111",'?');
    
    string s;
    while (getline(cin,s)) {
        solve111(s);
    }
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1220
final_rank: 8

code_snippet: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
#include <complex>
#include <cstring>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

map<char,string> cs;
map<string,char> sc;

void add(){
  
  cs[' '] = "11010";
  cs['\''] = "11110";
  cs[','] = "11100";
  cs['-'] = "11101";
  cs['.'] = "11011";
  cs['?'] = "11111";
  cs['A'] = "00000";
  cs['B'] = "00001";
  cs['C'] = "00010";
  cs['D'] = "00011";
  cs['E'] = "00100";
  cs['F'] = "00101";
  cs['G'] = "00110";
  cs['H'] = "00111";
  cs['I'] = "01000";
  cs['J'] = "01001";
  cs['K'] = "01010";
  cs['L'] = "01011";
  cs['M'] = "01100";
  cs['N'] = "01101";
  cs['O'] = "01110";
  cs['P'] = "01111";
  cs['Q'] = "10000";
  cs['R'] = "10001";
  cs['S'] = "10010";
  cs['T'] = "10011";
  cs['U'] = "10100";
  cs['V'] = "10101";
  cs['W'] = "10110";
  cs['X'] = "10111";
  cs['Y'] = "11000";
  cs['Z'] = "11001";
  
  sc["100101"] = 'A';
  sc["10011010"] = 'B';
  sc["0101"] = 'C';
  sc["0001"] = 'D';
  sc["110"] = 'E';
  sc["01001"] = 'F';
  sc["10011011"] = 'G';
  sc["010000"] = 'H';
  sc["0111"] = 'I';
  sc["10011000"] = 'J';
  sc["0110"] = 'K';
  sc["00100"] = 'L';
  sc["10011001"] = 'M';
  sc["10011110"] = 'N';
  sc["00101"] = 'O';
  sc["111"] = 'P';
  sc["10011111"] = 'Q';
  sc["1000"] = 'R';
  sc["00110"] = 'S';
  sc["00111"] = 'T';
  sc["10011100"] = 'U';
  sc["10011101"] = 'V';
  sc["000010"] = 'W';
  sc["10010010"] = 'X';
  sc["10010011"] = 'Y';
  sc["10010000"] = 'Z';
  sc["101"] = ' ';
  sc["010001"] = '.';
  sc["000011"] = ',';
  sc["10010001"] = '-';
  sc["000000"] = '\'';
  sc["000001"] = '?';
}

int main(void){
  add();
  string s;
  while(getline(cin,s)){
    string bit;
    rep(i,s.size()){
      bit += cs[s[i]];
    }
    //cout<<bit<<endl;

    int st = 0;
    string ret = "";
    rep(i,bit.size()){
      //cout<<ret<<endl;
      if(sc[bit.substr(st,i-st+1)]){
	ret += sc[bit.substr(st,i-st+1)];
	st = i + 1;
      }
    }
    cout<<ret<<endl;
  }
}
accuracy: 1
time_ms: 10
memory_kb: 1216
final_rank: 7

code_snippet: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

map<char, int> m1;
string parse;

string make2(char c) {
	string res;
	int x = m1[c];

	REP(i, 5) {
		res.push_back((x & 1) + '0');
		x >>= 1;
	}
	reverse(res.begin(), res.end());
	return res;
}

int main() {
	parse = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-\'?";
	REP(i, parse.size()) m1[parse[i]] = i;
	
	string sec[32] = {
		"100101","10011010","0101","0001","110","01001","10011011","010000",
		"0111","10011000","0110","00100","10011001","10011110","00101","111",
		"10011111","1000","00110","00111","10011100","10011101","000010","10010010",
		"10010011","10010000","101","010001","000011","10010001","000000","000001"	
	};
	map<string, int> m2;
	REP(i, 32) m2[sec[i]] = i;
	
	string str;
	while (getline(cin, str)) {
		string tmp;
		REP(i, str.size()) tmp += make2(str[i]);
		
		string ans;
		int pos = 0;
		REP(i, tmp.size()) {
			string s;
			FOR(j, i, tmp.size()) {
				s += tmp[j];
				i = j;
				if (m2.find(s) != m2.end()) {
					ans.push_back(parse[m2[s]]);
					break;
				}
			}
			pos += i;
		}
		cout << ans << endl;
	}
	
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1196
final_rank: 1

code_snippet: #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

map<char, string> enc;
map<string, char> word;

void inputData(){
    enc['A'] = "00000";
    enc['B'] = "00001";
    enc['C'] = "00010";
    enc['D'] = "00011";
    enc['E'] = "00100";
    enc['F'] = "00101";
    enc['G'] = "00110";
    enc['H'] = "00111";
    enc['I'] = "01000";
    enc['J'] = "01001";
    enc['K'] = "01010";
    enc['L'] = "01011";
    enc['M'] = "01100";
    enc['N'] = "01101";
    enc['O'] = "01110";
    enc['P'] = "01111";
    enc['Q'] = "10000";
    enc['R'] = "10001";
    enc['S'] = "10010";
    enc['T'] = "10011";
    enc['U'] = "10100";
    enc['V'] = "10101";
    enc['W'] = "10110";
    enc['X'] = "10111";
    enc['Y'] = "11000";
    enc['Z'] = "11001";
    enc[' '] = "11010";
    enc['.'] = "11011";
    enc[','] = "11100";
    enc['-'] = "11101";
    enc['\''] = "11110";
    enc['?'] = "11111";
    word["101"] = ' ';
    word["000000"] = '\'';
    word["000011"] = ',';
    word["10010001"] = '-';
    word["010001"] = '.';
    word["000001"] = '?';
    word["100101"] = 'A';
    word["10011010"] = 'B';
    word["0101"] = 'C';
    word["0001"] = 'D';
    word["110"] = 'E';
    word["01001"] = 'F';
    word["10011011"] = 'G';
    word["010000"] = 'H';
    word["0111"] = 'I';
    word["10011000"] = 'J';
    word["0110"] = 'K';
    word["00100"] = 'L';
    word["10011001"] = 'M';
    word["10011110"] = 'N';
    word["00101"] = 'O';
    word["111"] = 'P';
    word["10011111"] = 'Q';
    word["1000"] = 'R';
    word["00110"] = 'S';
    word["00111"] = 'T';
    word["10011100"] = 'U';
    word["10011101"] = 'V';
    word["000010"] = 'W';
    word["10010010"] = 'X';
    word["10010011"] = 'Y';
    word["10010000"] = 'Z';
}

string changeWord(string s){
    string sentence,a;
    rep(i,s.size()){
        a+=s[i];
        if((word[a] >= 'A'&& word[a] <= 'Z') || word[a] == ' ' || word[a] == '\'' || word[a] == ',' || word[a] == '-' || word[a] == '.' || word[a] == '?'){
            sentence+=word[a];
            a = "";
        }
    }
    return sentence;
}

string changeCode(string s){
    string code;
    rep(i,s.size()){
        code+=enc[s[i]];
    }
    return code;
}

int main(){
    inputData();
    string s;
    while(getline(cin,s)){
        cout << changeWord(changeCode(s)) << endl;;
    }
}
accuracy: 1
time_ms: 30
memory_kb: 1220
final_rank: 15

code_snippet: # define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <set>
# include <map>
# include <stack>
using namespace std;
# define M_PI 3.141592
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define pri_max 60000
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;


int main()
{
	map<char, string> enc;
	map<string, char> dec;
	for (char i = 'A'; i <= 'Z'; i++)
	{
		stringstream ss;
		bitset < 5 > b(i-'A');
		ss << b;
		enc.insert(make_pair(i, ss.str()));
	}
	enc[' '] = "11010";
	enc['.'] = "11011";
	enc[','] = "11100";
	enc['-'] = "11101";
	enc['\''] = "11110";
	enc['?'] = "11111";

	dec["101"] = ' ';
	dec["000000"] = '\'';
	dec["000011"] = ',';
	dec["10010001"] = '-';
	dec["010001"] = '.';
	dec["000001"] = '?';
	dec["100101"] = 'A';
	dec["10011010"] = 'B';
	dec["0101"] = 'C';
	dec["0001"] = 'D';
	dec["110"] = 'E';
	dec["01001"] = 'F';
	dec["10011011"] = 'G';
	dec["010000"] = 'H';
	dec["0111"] = 'I';
	dec["10011000"] = 'J';
	dec["0110"] = 'K';
	dec["00100"] = 'L';
	dec["10011001"] = 'M';
	dec["10011110"] = 'N';
	dec["00101"] = 'O';
	dec["111"] = 'P';
	dec["10011111"] = 'Q';
	dec["1000"] = 'R';
	dec["00110"] = 'S';
	dec["00111"] = 'T';
	dec["10011100"] = 'U';
	dec["10011101"] = 'V';
	dec["000010"] = 'W';
	dec["10010010"] = 'X';
	dec["10010011"] = 'Y';
	dec["10010000"] = 'Z';

	string s;
	while (getline(cin,s))
	{
		string x, y, z;
		for (int i = 0; i < s.size(); i++)x += enc[s[i]];

		for (int i = 0; i < x.size(); i++)
		{
			y += x[i];
			if (dec.count(y))
			{
				z += dec[y];
				y = "";
			}
		}
		cout << z << endl;

	}

}
accuracy: 1
time_ms: 10
memory_kb: 1224
final_rank: 11

code_snippet: #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

map<string,string> board;
map<string,string> word;

void config(){
  string w = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
  string s = "00000";
  string h[] = {"100101","10011010","0101","0001","110","01001","10011011",
		"010000","0111","10011000","0110","00100","10011001",
		"10011110","00101","111","10011111","1000",
		"00110","00111","10011100","10011101",
		"000010","10010010","10010011","10010000",
		"101","010001","000011","10010001","000000","000001"};
  for(int i=0;i<w.size();i++){
    string tmp = "";
    tmp += w[i];
    board[tmp] = s;
    word[h[i]] = w[i];
    /*
    cout << tmp << " " << s << endl;
    cout << h[i] << " " << w[i] << endl << endl;
    */
    if(s[4] == '0') s[4] = '1';
    else {
      for(int j=4;j>=0;j--){
	if(s[j] == '0'){
	  s[j] = '1';
	  break;
	}
	else s[j] = '0';
      }
    }
  }
}

int main(){
  config();
  string str;
  while(getline(cin,str)){
    string next = "";
    for(int i=0;i<str.size();i++){
      string tmp = "";
      tmp += str[i];
      next += board[tmp];
    }
    string ans = "";
    string now = "";
    for(int i=0;i<next.size();i++){
      now += next[i];
      if(word[now] != word["AA"]){
	ans += word[now];
	now = "";
      }
    }
    cout << ans << endl;
  }
}
accuracy: 1
time_ms: 10
memory_kb: 1208
final_rank: 3

code_snippet: #include<iostream>
#include<string>
using namespace std;

char A1[33] = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char B1[33] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";

string A2[32] = {
	"101",
	"000000",
	"000011",
	"10010001",
	"010001",
	"000001",
	"100101",
	"10011010",
	"0101",
	"0001",
	"110",
	"01001",
	"10011011",
	"010000",
	"0111",
	"10011000",
	"0110",
	"00100",
	"10011001",
	"10011110",
	"00101",
	"111",
	"10011111",
	"1000",
	"00110",
	"00111",
	"10011100",
	"10011101",
	"000010",
	"10010010",
	"10010011",
	"10010000"
};

string B2[32] = {
	"00000",
	"00001",
	"00010",
	"00011",
	"00100",
	"00101",
	"00110",
	"00111",
	"01000",
	"01001",
	"01010",
	"01011",
	"01100",
	"01101",
	"01110",
	"01111",
	"10000",
	"10001",
	"10010",
	"10011",
	"10100",
	"10101",
	"10110",
	"10111",
	"11000",
	"11001",
	"11010",
	"11011",
	"11100",
	"11101",
	"11110",
	"11111"
};

string U;
string V;

int main() {
	while (getline(cin, U)) {
		V = "";
		for (int i = 0; i < U.size(); i++) {
			for (int j = 0; j < 32; j++) {
				if (B1[j] == U[i]) {
					V += B2[j];
				}
			}
		}
		U = "";
		int pass = 0;
		while (pass < V.size()) {
			for (int j = 0; j < 32; j++) {
				if (pass + A2[j].size() <= V.size()) {
					if (A2[j] == V.substr(pass, A2[j].size())) {
						U += A1[j];
						pass += A2[j].size();
						goto I;
					}
				}
			}
			break;
		I:;
		}
		cout << U << endl;
	}
	return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 1196
final_rank: 13

code_snippet: #include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;




const int INF = 1000000;
const int mod = 1e9 + 7;


string calc(int n){
	string ret = "";
	for(int i=0; i<5; i++){
		ret += (char)('0' + n % 2);
		n /= 2;
	}
	reverse(all(ret));
	return ret;
}

int main(){
	map<char,string> m;
	rep(i,26) m[(char)('A' + i)] =calc(i);
	m[' '] = calc(26);
	m['.'] = calc(27);
	m[','] = calc(28);
	m['-'] = calc(29);
	m['\''] = calc(30);
	m['?'] = calc(31);
	map<string,char> mm;
	mm["101"] = ' ';
	mm["000000"] = '\'';
	mm["000011"] = ',';
	mm["10010001"] = '-';
	mm["010001"] = '.';
	mm["000001"] = '?';
	mm["100101"] = 'A';
	mm["10011010"] = 'B';
	mm["0101"] = 'C';
	mm["0001"] = 'D';
	mm["110"] = 'E';
	mm["01001"] ='F';
	mm["10011011"] = 'G';
	mm["010000"] = 'H';
	mm["0111"] = 'I';
	mm["10011000"] = 'J';
	mm["0110"] = 'K';
	mm["00100"] = 'L';
	mm["10011001"] = 'M';
	mm["10011110"] = 'N';
	mm["00101"] = 'O';
	mm["111"] = 'P';
	mm["10011111"] = 'Q';
	mm["1000"] = 'R';
	mm["00110"] = 'S';
	mm["00111"] = 'T';
	mm["10011100"] = 'U';
	mm["10011101"] = 'V';
	mm["000010"] = 'W';
	mm["10010010"] = 'X';
	mm["10010011"] = 'Y';
	mm["10010000"] = 'Z';
	string s;
	while(getline(cin,s)){
		string t ="";
		for(int i=0; i<s.size(); i++){
			t+=m[s[i]];
		}
		string ans = "";
		for(int i=0; i<t.size(); i++){
			int j=i;
			string str ="";
			while(mm[str] ==  (char)0 && j<t.size()) str += t[j++];
			//cout<<mm[str]<<endl;
			if(mm[str] != 0) ans += mm[str];
			i=j-1;
		}
		cout<<ans<<endl;
	}

}
accuracy: 1
time_ms: 10
memory_kb: 1208
final_rank: 3

code_snippet: #include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=1e9;
const int MOD=100000;
string rec1(string in){
	string res="";
	map<char,string> s;
	s['A']="00000";
	s['B']="00001";
	s['C']="00010";
	s['D']="00011";
	s['E']="00100";
	s['F']="00101";
	s['G']="00110";
	s['H']="00111";
	s['I']="01000";
	s['J']="01001";
	s['K']="01010";
	s['L']="01011";
	s['M']="01100";
	s['N']="01101";
	s['O']="01110";
	s['P']="01111";
	s['Q']="10000";
	s['R']="10001";
	s['S']="10010";
	s['T']="10011";
	s['U']="10100";
	s['V']="10101";
	s['W']="10110";
	s['X']="10111";
	s['Y']="11000";
	s['Z']="11001";
	s[' ']="11010";
	s['.']="11011";
	s[',']="11100";
	s['-']="11101";
	s['\'']="11110";
	s['?']="11111";
	REP(i,in.size())res+=s[in[i]];
	return res;
}
string rec2(string in){
	string res="",t="";
	map<string,char>s;
	s["101"]=' ';
	s["000000"]='\'';
	s["000011"]=',';
	s["10010001"]='-';
	s["010001"]='.';
	s["000001"]='?';
	s["100101"]='A';
	s["10011010"]='B';
	s["0101"]='C';
	s["0001"]='D';
	s["110"]='E';
	s["01001"]='F';
	s["10011011"]='G';
	s["010000"]='H';
	s["0111"]='I';
	s["10011000"]='J';
	s["0110"]='K';
	s["00100"]='L';
	s["10011001"]='M';
	s["10011110"]='N';
	s["00101"]='O';
	s["111"]='P';
	s["10011111"]='Q';
	s["1000"]='R';
	s["00110"]='S';
	s["00111"]='T';
	s["10011100"]='U';
	s["10011101"]='V';
	s["000010"]='W';
	s["10010010"]='X';
	s["10010011"]='Y';
	s["10010000"]='Z';
	REP(i,in.size()){
		t+=in[i];
		if(s.find(t)!=s.end()){
			res+=s[t];
			t="";
		}
	}
	return res;
}
int main(){
	string in;
	while(getline(cin,in)){
		in=rec1(in);
		cout<<rec2(in)<<endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 1220
final_rank: 8

code_snippet: #include<iostream>
#include<string>
#include<cstring>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

string table1[32]={"101","000000","000011","10010001","010001","000001","100101","10011010","0101","0001","110","01001","10011011","010000","0111","10011000","0110","00100","10011001","10011110","00101","111","10011111","1000","00110","00111","10011100","10011101","000010","10010010","10010011","10010000"};
char table2[6]={' ','\'',',','-','.','?'};

string binary(int num){
	string ans="";
	for(int i=4;i>=0;i--){
		ans+=(char)(num/(int)pow(2,i)+'0');
		num-=(num/(int)pow(2,i))*(int)pow(2,i);
	}
	return ans;
}

string change(char c){
	string ans;
	if(isalpha(c)){
		int num=c-'A';
		ans=binary(num);
	}else{
		if(c==' ')ans=binary(26);
		else if(c=='.')ans=binary(27);
		else if(c==',')ans=binary(28);
		else if(c=='-')ans=binary(29);
		else if(c=='\'')ans=binary(30);
		else if(c=='?')ans=binary(31);
	}
	if(ans.size()<5)ans='0'+ans;
	return ans;
}

string rechange(string str){
	int size=str.size();
	string pack="",ans="";
	int counta=0;
	while(counta<size){
		pack+=str[counta];
		for(int i=0;i<32;i++){
			if(pack==table1[i]){
				if(i<6){
					ans+=table2[i];
				}else{
					ans+=(char)(i-6+'A');
				}
				pack="";
				break;
			}
		}
		counta++;
	}
	return ans;
}

int main(){
	string s;
	while(getline(cin,s)){
		int size=s.size();
		string alt="";
		rep(i,size){
			alt+=change(s[i]);
		}
		cout<<rechange(alt)<<endl;
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1248
final_rank: 12

code_snippet: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  map<char,string>in;
  in['A']="00000";
  in['B']="00001";
  in['C']="00010";
  in['D']="00011";
  in['E']="00100";
  in['F']="00101";
  in['G']="00110";
  in['H']="00111";
  in['I']="01000";
  in['J']="01001";
  in['K']="01010";
  in['L']="01011";
  in['M']="01100";
  in['N']="01101";
  in['O']="01110";
  in['P']="01111";
  in['Q']="10000";
  in['R']="10001";
  in['S']="10010";
  in['T']="10011";
  in['U']="10100";
  in['V']="10101";
  in['W']="10110";
  in['X']="10111";
  in['Y']="11000";
  in['Z']="11001";
  in[' ']="11010";
  in['.']="11011";
  in[',']="11100";
  in['-']="11101";
  in['\'']="11110";
  in['?']="11111";
  map<string,char>out;
  out["101"]=' ';
  out["000000"]='\'';
  out["000011"]=',';
  out["10010001"]='-';
  out["010001"]='.';
  out["000001"]='?';
  out["100101"]='A';
  out["10011010"]='B';
  out["0101"]='C';
  out["0001"]='D';
  out["110"]='E';
  out["01001"]='F';
  out["10011011"]='G';
  out["010000"]='H';
  out["0111"]='I';
  out["10011000"]='J';
  out["0110"]='K';
  out["00100"]='L';
  out["10011001"]='M';
  out["10011110"]='N';
  out["00101"]='O';
  out["111"]='P';
  out["10011111"]='Q';
  out["1000"]='R';
  out["00110"]='S';
  out["00111"]='T';
  out["10011100"]='U';
  out["10011101"]='V';
  out["000010"]='W';
  out["10010010"]='X';
  out["10010011"]='Y';
  out["10010000"]='Z';

  string s;
  while(getline(cin,s)){
    string a="";
    rep(i,s.size())a+=in[s[i]];
    int to=0;
    string tmp="";
    while(to<a.size()){
      tmp+=a[to];
      to++;
      if(out[tmp]){
	cout<<out[tmp];
	tmp="";
      }
    }
    cout<<endl;
  }
}
accuracy: 1
time_ms: 10
memory_kb: 1204
final_rank: 2

code_snippet: //Doctor's Memorable Codes
#include<bits/stdc++.h>
using namespace std;

string into(string s){
  string ret="";
  for(int i=0; i<s.length(); i++){
    if(s[i]=='A')ret+="00000";
    if(s[i]=='B')ret+="00001";
    if(s[i]=='C')ret+="00010";
    if(s[i]=='D')ret+="00011";
    if(s[i]=='E')ret+="00100";
    if(s[i]=='F')ret+="00101";
    if(s[i]=='G')ret+="00110";
    if(s[i]=='H')ret+="00111";
    if(s[i]=='I')ret+="01000";
    if(s[i]=='J')ret+="01001";
    if(s[i]=='K')ret+="01010";
    if(s[i]=='L')ret+="01011";
    if(s[i]=='M')ret+="01100";
    if(s[i]=='N')ret+="01101";
    if(s[i]=='O')ret+="01110";
    if(s[i]=='P')ret+="01111";
    if(s[i]=='Q')ret+="10000";
    if(s[i]=='R')ret+="10001";
    if(s[i]=='S')ret+="10010";
    if(s[i]=='T')ret+="10011";
    if(s[i]=='U')ret+="10100";
    if(s[i]=='V')ret+="10101";
    if(s[i]=='W')ret+="10110";
    if(s[i]=='X')ret+="10111";
    if(s[i]=='Y')ret+="11000";
    if(s[i]=='Z')ret+="11001";
    if(s[i]==' ')ret+="11010";
    if(s[i]=='.')ret+="11011";
    if(s[i]==',')ret+="11100";
    if(s[i]=='-')ret+="11101";
    if(s[i]=='\'')ret+="11110";
    if(s[i]=='?')ret+="11111";
  }
  return ret;
}

string solve(string t){
  string s=into(t);
  string ret="";
  int l=0, r=0;
  for( ; r!=s.length(); r++){
    string tmp=s.substr(l, r-l+1);//文字列の切り出し
    if(tmp=="101"){ret+=" "; l=r+1;}
    if(tmp=="000000"){ret+="\'"; l=r+1;}
    if(tmp=="000011"){ret+=","; l=r+1;}
    if(tmp=="10010001"){ret+="-"; l=r+1;}
    if(tmp=="010001"){ret+="."; l=r+1;}
    if(tmp=="000001"){ret+="?"; l=r+1;}
    if(tmp=="100101"){ret+="A"; l=r+1;}
    if(tmp=="10011010"){ret+="B"; l=r+1;}
    if(tmp=="0101"){ret+="C"; l=r+1;}
    if(tmp=="0001"){ret+="D"; l=r+1;}
    if(tmp=="110"){ret+="E"; l=r+1;}
    if(tmp=="01001"){ret+="F"; l=r+1;}
    if(tmp=="10011011"){ret+="G"; l=r+1;}
    if(tmp=="010000"){ret+="H"; l=r+1;}
    if(tmp=="0111"){ret+="I"; l=r+1;}
    if(tmp=="10011000"){ret+="J"; l=r+1;}
    if(tmp=="0110"){ret+="K"; l=r+1;}
    if(tmp=="00100"){ret+="L"; l=r+1;}
    if(tmp=="10011001"){ret+="M"; l=r+1;}
    if(tmp=="10011110"){ret+="N"; l=r+1;}
    if(tmp=="00101"){ret+="O"; l=r+1;}
    if(tmp=="111"){ret+="P"; l=r+1;}
    if(tmp=="10011111"){ret+="Q"; l=r+1;}
    if(tmp=="1000"){ret+="R"; l=r+1;}
    if(tmp=="00110"){ret+="S"; l=r+1;}
    if(tmp=="00111"){ret+="T"; l=r+1;}
    if(tmp=="10011100"){ret+="U"; l=r+1;}
    if(tmp=="10011101"){ret+="V"; l=r+1;}
    if(tmp=="000010"){ret+="W"; l=r+1;}
    if(tmp=="10010010"){ret+="X"; l=r+1;}
    if(tmp=="10010011"){ret+="Y"; l=r+1;}
    if(tmp=="10010000"){ret+="Z"; l=r+1;}
  }
  return ret;
}

int main(){
  string s;
  while(getline(cin, s))cout<<solve(s)<<endl;
  return 0;
}
accuracy: 1
time_ms: 40
memory_kb: 1196
final_rank: 19

code_snippet: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

map<char,string> b;

string ch1(string s){
    string ret="";
    rep(i,s.size()){
        ret+=b[s[i]];
    }
    return ret;
}



string solve(string s){
    string ret;

    int bef=-1;
    for(int i=0;i<s.size();){
        if(bef==i)break;
        bef=i;
        if( s.size() - i>=3 ){
            if( s.substr(i,3)=="101" )ret+=' ',i+=3;
            if( s.substr(i,3)=="110" )ret+='E',i+=3;
            if( s.substr(i,3)=="111" )ret+='P',i+=3;
        }
        if( s.size() - i>=4 ){
            if( s.substr(i,4)=="0101" )ret+='C',i+=4;
            if( s.substr(i,4)=="0001" )ret+='D',i+=4;
            if( s.substr(i,4)=="0111" )ret+='I',i+=4;
            if( s.substr(i,4)=="0110" )ret+='K',i+=4;
            if( s.substr(i,4)=="1000" )ret+='R',i+=4;
        }
        if( s.size() - i>=5 ){
            if( s.substr(i,5)=="01001" )ret+='F',i+=5;
            if( s.substr(i,5)=="00100" )ret+='L',i+=5;
            if( s.substr(i,5)=="00101" )ret+='O',i+=5;
            if( s.substr(i,5)=="00110" )ret+='S',i+=5;
            if( s.substr(i,5)=="00111" )ret+='T',i+=5;
        }
        if( s.size() - i>=6 ){
            if( s.substr(i,6)=="000000" )ret+='\'',i+=6;
            if( s.substr(i,6)=="000011" )ret+=',',i+=6;
            if( s.substr(i,6)=="010001" )ret+='.',i+=6;
            if( s.substr(i,6)=="000001" )ret+='?',i+=6;
            if( s.substr(i,6)=="100101" )ret+='A',i+=6;
            if( s.substr(i,6)=="010000" )ret+='H',i+=6;
            if( s.substr(i,6)=="000010" )ret+='W',i+=6;

        }
        if( s.size() - i>=8 ){
            if( s.substr(i,8)=="10010001" )ret+='-',i+=8;
            if( s.substr(i,8)=="10011010" )ret+='B',i+=8;
            if( s.substr(i,8)=="10011011" )ret+='G',i+=8;
            if( s.substr(i,8)=="10011000" )ret+='J',i+=8;
            if( s.substr(i,8)=="10011001" )ret+='M',i+=8;
            if( s.substr(i,8)=="10011110" )ret+='N',i+=8;
            if( s.substr(i,8)=="10011111" )ret+='Q',i+=8;
            if( s.substr(i,8)=="10011100" )ret+='U',i+=8;
            if( s.substr(i,8)=="10011101" )ret+='V',i+=8;
            if( s.substr(i,8)=="10010010" )ret+='X',i+=8;
            if( s.substr(i,8)=="10010011" )ret+='Y',i+=8;
            if( s.substr(i,8)=="10010000" )ret+='Z',i+=8;
        }
    }
    
    return ret;
}


int main() {

    
    b['A'] ="00000";
    b['B'] ="00001";
    b['C'] ="00010";
    b['D'] ="00011";
    b['E'] ="00100";
    b['F'] ="00101";
    b['G'] ="00110";
    b['H'] ="00111";
    b['I'] ="01000";
    b['J'] ="01001";
    b['K'] ="01010";
    b['L'] ="01011";
    b['M'] ="01100";
    b['N'] ="01101";
    b['O'] ="01110";
    b['P'] ="01111";
    b['Q'] ="10000";
    b['R'] ="10001";
    b['S'] ="10010";
    b['T'] ="10011";
    b['U'] ="10100";
    b['V'] ="10101";
    b['W'] ="10110";
    b['X'] ="10111";
    b['Y'] ="11000";
    b['Z'] ="11001";
    b[' '] ="11010";
    b['.'] ="11011";
    b[','] ="11100";
    b['-'] ="11101";
    b['\'']="11110";
    b['?'] ="11111";

    string s;
    while(getline(cin,s)){
        string ans=ch1(s);
        cout<<solve(ans)<<endl;
    }
    return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 1208
final_rank: 14

code_snippet: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<string>
using namespace std;

map<char,string>a;
map<string,char>b;

void init(){
    a['A']="00000";
    a['B']="00001";
    a['C']="00010";
    a['D']="00011";
    a['E']="00100";
    a['F']="00101";
    a['G']="00110";
    a['H']="00111";
    a['I']="01000";
    a['J']="01001";
    a['K']="01010";
    a['L']="01011";
    a['M']="01100";
    a['N']="01101";
    a['O']="01110";
    a['P']="01111";
    a['Q']="10000";
    a['R']="10001";
    a['S']="10010";
    a['T']="10011";
    a['U']="10100";
    a['V']="10101";
    a['W']="10110";
    a['X']="10111";
    a['Y']="11000";
    a['Z']="11001";
    a[' ']="11010";
    a['.']="11011";
    a[',']="11100";
    a['-']="11101";
    a['\'']="11110";
    a['?']="11111";

    b["101"]=' ';
    b["000000"]='\'';
    b["000011"]=',';
    b["10010001"]='-';
    b["010001"]='.';
    b["000001"]='?';
    b["100101"]='A';
    b["10011010"]='B';
    b["0101"]='C';
    b["0001"]='D';
    b["110"]='E';
    b["01001"]='F';
    b["10011011"]='G';
    b["010000"]='H';
    b["0111"]='I';
    b["10011000"]='J';
    b["0110"]='K';
    b["00100"]='L';
    b["10011001"]='M';
    b["10011110"]='N';
    b["00101"]='O';
    b["111"]='P';
    b["10011111"]='Q';
    b["1000"]='R';
    b["00110"]='S';
    b["00111"]='T';
    b["10011100"]='U';
    b["10011101"]='V';
    b["000010"]='W';
    b["10010010"]='X';
    b["10010011"]='Y';
    b["10010000"]='Z';
}


int main(){
    init();
    string in;
    while(getline(cin,in)){
        string s,index,ans;
        for(int i=0;i<in.size();i++) s += a[in[i]];
        while(s.size()%5) s += '0';
        for(int i=0;i<s.size();i++){
            index += s[i];
            if(b.find(index)!=b.end()){
                ans += b[index]; index.clear();
            }
        }
        cout<<ans<<endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 1212
final_rank: 6

code_snippet: #include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iostream>
#include<cmath>
#include<map>
#include<set>
using namespace std;
typedef vector<string>vs;
typedef vector<int>vi;
typedef vector<vi>vvi;
typedef vector<double>vd;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll>pll;
typedef vector<ll>vl;
#define rrep(i,x,n) for(int i=(x);i<(n);++i)
#define rep(i,x) rrep(i,0,(x))
#define fi first
#define se second
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define maxs(a,b) (a)=max(a,b)
#define mins(a,b) (a)=min(a,b)

map<char,string>a;
map<string,char>b;

void init(){
    a['A']="00000";
    a['B']="00001";
    a['C']="00010";
    a['D']="00011";
    a['E']="00100";
    a['F']="00101";
    a['G']="00110";
    a['H']="00111";
    a['I']="01000";
    a['J']="01001";
    a['K']="01010";
    a['L']="01011";
    a['M']="01100";
    a['N']="01101";
    a['O']="01110";
    a['P']="01111";
    a['Q']="10000";
    a['R']="10001";
    a['S']="10010";
    a['T']="10011";
    a['U']="10100";
    a['V']="10101";
    a['W']="10110";
    a['X']="10111";
    a['Y']="11000";
    a['Z']="11001";
    a[' ']="11010";
    a['.']="11011";
    a[',']="11100";
    a['-']="11101";
    a['\'']="11110";
    a['?']="11111";

    b["101"]=' ';
    b["000000"]='\'';
    b["000011"]=',';
    b["10010001"]='-';
    b["010001"]='.';
    b["000001"]='?';
    b["100101"]='A';
    b["10011010"]='B';
    b["0101"]='C';
    b["0001"]='D';
    b["110"]='E';
    b["01001"]='F';
    b["10011011"]='G';
    b["010000"]='H';
    b["0111"]='I';
    b["10011000"]='J';
    b["0110"]='K';
    b["00100"]='L';
    b["10011001"]='M';
    b["10011110"]='N';
    b["00101"]='O';
    b["111"]='P';
    b["10011111"]='Q';
    b["1000"]='R';
    b["00110"]='S';
    b["00111"]='T';
    b["10011100"]='U';
    b["10011101"]='V';
    b["000010"]='W';
    b["10010010"]='X';
    b["10010011"]='Y';
    b["10010000"]='Z';
}


int main(){
    init();
    string str;
    while(getline(cin,str)){
        string s;
        rep(i,str.size())s+=a[str[i]];
        int cur=0;
        while(true){
            bool used=false;
            for(int i=1;cur+i<=s.size();i++){

                if(b.find(s.substr(cur,i))==b.end())continue;
                used=true;
                cout<<b[s.substr(cur,i)];
                cur+=i;
                break;
            }
            if(cur==s.size()||used==false)break;
        }
        cout<<endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 1208
final_rank: 3

code_snippet: #include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

bool isLeap(int y);
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
double distanceAB(double xa, double ya, double xb, double yb);
void trace(int A[], int N);

/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/


string getConversion1(string inp)
{
	string ret = "";
	map<char, string> tbl;
	
	tbl['A'] = "00000";
	tbl['B'] = "00001";
	tbl['C'] = "00010";
	tbl['D'] = "00011";
	tbl['E'] = "00100";
	tbl['F'] = "00101";
	tbl['G'] = "00110";
	tbl['H'] = "00111";
	tbl['I'] = "01000";
	tbl['J'] = "01001";
	tbl['K'] = "01010";
	tbl['L'] = "01011";
	tbl['M'] = "01100";
	tbl['N'] = "01101";
	tbl['O'] = "01110";
	tbl['P'] = "01111";
	tbl['Q'] = "10000";
	tbl['R'] = "10001";
	tbl['S'] = "10010";
	tbl['T'] = "10011";
	tbl['U'] = "10100";
	tbl['V'] = "10101";
	tbl['W'] = "10110";
	tbl['X'] = "10111";
	tbl['Y'] = "11000";
	tbl['Z'] = "11001";
	tbl[' '] = "11010";
	tbl['.'] = "11011";
	tbl[','] = "11100";
	tbl['-'] = "11101";
	tbl['\''] = "11110";
	tbl['?'] = "11111";
	
	rep(i, inp.length())
	{
		ret += tbl[inp[i]];
	}
	
	return ret;
}

string getConversion2(string inp)
{
	string ret = "", key = "";
	map<string, char> tbl;
	
	tbl["101"] = ' ';
	tbl["000000"] = '\'';
	tbl["000011"] = ',';
	tbl["10010001"] = '-';
	tbl["010001"] = '.';
	tbl["000001"] = '?';
	tbl["100101"] = 'A';
	tbl["10011010"] = 'B';
	tbl["0101"] = 'C';
	tbl["0001"] = 'D';
	tbl["110"] = 'E';
	tbl["01001"] = 'F';
	tbl["10011011"] = 'G';
	tbl["010000"] = 'H';
	tbl["0111"] = 'I';
	tbl["10011000"] = 'J';
	tbl["0110"] = 'K';
	tbl["00100"] = 'L';
	tbl["10011001"] = 'M';
	tbl["10011110"] = 'N';
	tbl["00101"] = 'O';
	tbl["111"] = 'P';
	tbl["10011111"] = 'Q';
	tbl["1000"] = 'R';
	tbl["00110"] = 'S';
	tbl["00111"] = 'T';
	tbl["10011100"] = 'U';
	tbl["10011101"] = 'V';
	tbl["000010"] = 'W';
	tbl["10010010"] = 'X';
	tbl["10010011"] = 'Y';
	tbl["10010000"] = 'Z';
	
	rep(i, inp.length())
	{
		key += inp[i];
		if (tbl.find(key) != tbl.end())
		{
			ret += tbl[key];
			key = "";
		}
	}
	
	return ret;
}


int main()
{
	string inp, conv, ans;
	
	while (getline(cin, inp))
	{
		conv = getConversion1(inp);
		
		//cout << conv << endl;
		
		ans = getConversion2(conv);
		
		cout << ans << endl;
	}
	
	return 0;
}


bool isLeap(int y)
{
	return y % 400 == 0
						? true : y % 100 == 0
						? false : y % 4 == 0
						? true : false;
}

ll gcd(ll a, ll b)
{
	return (b > 0) ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}

void trace(int A[], int N)
{
	REP(N)
	{
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
}

double distanceAB(double xa, double ya, double xb, double yb)
{
	return sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya));
}
accuracy: 1
time_ms: 10
memory_kb: 1220
final_rank: 8