#include <string>
#include <iostream>
#include <iomanip>
unsigned to_unsigned(char ch)
{
return static_cast<unsigned>(static_cast<unsigned char>(ch));
}
int main()
{
std::cout << "Enter a string: ";
std::string line;
std::getline(std::cin, line);
for (std::size_t pos = 0; pos < line.size(); ++pos)
{
std::cout << std::setfill(' ');
std::cout << std::setw(2) << line[pos];
unsigned ascii = to_unsigned(line[pos]);
std::cout << " = " << std::setw(3) << std::dec << ascii;
std::cout << " = 0x" << std::setw(2) << std::hex << std::setfill('0') << ascii;
std::cout << '\n';
}
}
I2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KCnVuc2lnbmVkIHRvX3Vuc2lnbmVkKGNoYXIgY2gpCnsKICAgIHJldHVybiBzdGF0aWNfY2FzdDx1bnNpZ25lZD4oc3RhdGljX2Nhc3Q8dW5zaWduZWQgY2hhcj4oY2gpKTsKfQoKaW50IG1haW4oKQp7CiAgICBzdGQ6OmNvdXQgPDwgIkVudGVyIGEgc3RyaW5nOiAiOwoKICAgIHN0ZDo6c3RyaW5nIGxpbmU7CiAgICBzdGQ6OmdldGxpbmUoc3RkOjpjaW4sIGxpbmUpOwoKICAgIGZvciAoc3RkOjpzaXplX3QgcG9zID0gMDsgcG9zIDwgbGluZS5zaXplKCk7ICsrcG9zKQogICAgewogICAgICAgIHN0ZDo6Y291dCA8PCBzdGQ6OnNldGZpbGwoJyAnKTsKICAgICAgICBzdGQ6OmNvdXQgPDwgc3RkOjpzZXR3KDIpIDw8IGxpbmVbcG9zXTsKCiAgICAgICAgdW5zaWduZWQgYXNjaWkgPSB0b191bnNpZ25lZChsaW5lW3Bvc10pOwoKICAgICAgICBzdGQ6OmNvdXQgPDwgIiA9ICIgPDwgc3RkOjpzZXR3KDMpIDw8IHN0ZDo6ZGVjIDw8IGFzY2lpOwogICAgICAgIHN0ZDo6Y291dCA8PCAiID0gMHgiIDw8IHN0ZDo6c2V0dygyKSA8PCBzdGQ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