#include <iostream>
#include <string>
#include <cassert>
#include <utility>
struct translator
{
translator(std::string src, std::string tgt)
: _source(std::move(src)), _target(std::move(tgt))
{
assert(_source.length() == _target.length());
}
char operator()(char ch) const;
private:
std::string _source;
std::string _target;
};
// if ch is found in _source, return the corresponding character in _target
// if it isn't found in _source, return ch
char translator::operator()(char ch) const
{
auto pos = _source.find(ch);
return pos == std::string::npos ? ch : _target[pos];
}
// helper function. Applies translator to every element in a string.
std::string translate(const translator& xlate, std::string s)
{
for (auto& ch : s)
ch = xlate(ch);
return s;
}
int main()
{
translator xlator("0123456789", "ABCDEFGHIJ");
std::string line;
while (std::getline(std::cin, line) && !line.empty())
std::cout << translate(xlator, line) << '\n';
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8Y2Fzc2VydD4KI2luY2x1ZGUgPHV0aWxpdHk+CgpzdHJ1Y3QgdHJhbnNsYXRvcgp7CiAgICB0cmFuc2xhdG9yKHN0ZDo6c3RyaW5nIHNyYywgc3RkOjpzdHJpbmcgdGd0KSAKICAgICAgICA6IF9zb3VyY2Uoc3RkOjptb3ZlKHNyYykpLCBfdGFyZ2V0KHN0ZDo6bW92ZSh0Z3QpKSAKICAgIHsKICAgICAgICBhc3NlcnQoX3NvdXJjZS5sZW5ndGgoKSA9PSBfdGFyZ2V0Lmxlbmd0aCgpKTsKICAgIH0KCgogICAgY2hhciBvcGVyYXRvcigpKGNoYXIgY2gpIGNvbnN0OwoKcHJpdmF0ZToKICAgIHN0ZDo6c3RyaW5nIF9zb3VyY2U7CiAgICBzdGQ6OnN0cmluZyBfdGFyZ2V0Owp9OwoKCi8vIGlmIGNoIGlzIGZvdW5kIGluIF9zb3VyY2UsIHJldHVybiB0aGUgY29ycmVzcG9uZGluZyBjaGFyYWN0ZXIgaW4gX3RhcmdldAovLyBpZiBpdCBpc24ndCBmb3VuZCBpbiBfc291cmNlLCByZXR1cm4gY2gKY2hhciB0cmFuc2xhdG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