#include <bits/stdc++.h>
using namespace std;
string a;
string ans;
int main()
{
bool plus;
int suma = 0, sumb = 0;
cin >> a;
if (a.size() % 8)
{
cout << "Error" << endl;
return 0;
}
else
{
plus = false;
for (int i = 1; i * 8 <= a.size(); i++)
{
for (int j = 1; j <= 8; j++)
{
if (a[i * 8 - j] != '0' && a[i * 8 - j] != '1')
{
cout << "Error" << endl;
return 0;
}
}
if (plus)
{
if (a[i * 8 - 8] == '0')
{
for (int j = 8; j >= 1; j--)
{
if (a[i * 8 - j] - '0' == 1)
{
sumb += 1 << (j - 1);
}
}
ans += to_string(suma / 2 + sumb / 2);
suma = 0, sumb = 0;
plus = false;
continue;
}
else
{
cout<<"Error"<<endl;
return 0;
}
}
if (a[i * 8 - 8] == '1' && a[i * 8 - 7] == '0' && a[i * 8 - 6] == '1')
{
int num = 0;
for (int j = 5; j >= 1; j--)
{
if (a[i * 8 - j] - '0' == 1)
{
num += 1 << (j - 1);
}
}
ans += 'A' + num;
}
else
{
if (a[i * 8 - 8] == '1' && a[i * 8 - 7] == '1' && a[i * 8 - 6] == '1')
{
ans += ' ';
}
else
{
if (a[i * 8 - 8] == '0')
{
for (int j = 8; j >= 1; j--)
{
if (a[i * 8 - j] - '0' == 1)
{
suma += 1 << (j - 1);
}
}
plus = true;
}
else
{
cout << "Error" << endl;
return 0;
}
}
}
}
}
if (plus)
{
cout << "Error" << endl;
return 0;
}
cout << ans;
return 0;
}