fork(4) download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <map>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. string superscriptNumber(int x) {
  9. static auto superscriptDic = map<char, string> {
  10. {'0', "\xE2\x81\xB0"},
  11. {'1', "\xC2\xB9"},
  12. {'2', "\xC2\xB2"},
  13. {'3', "\xC2\xB3"},
  14. {'4', "\xE2\x81\xB4"},
  15. {'5', "\xE2\x81\xB5"},
  16. {'6', "\xE2\x81\xB6"},
  17. {'7', "\xE2\x81\xB7"},
  18. {'8', "\xE2\x81\xB8"},
  19. {'9', "\xE2\x81\xB9"}
  20. };
  21. string result;
  22. for (auto a : to_string(x)) {
  23. result.append(superscriptDic[a]);
  24. }
  25.  
  26. return result;
  27. }
  28.  
  29. int main() {
  30. int x;
  31.  
  32. while (cin >> x) {
  33. cout << "x" << superscriptNumber(x) << "!" << endl;
  34. }
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0s 3280KB
stdin
1234
30789
5601
stdout
x¹²³⁴!
x³⁰⁷⁸⁹!
x⁵⁶⁰¹!