Advertisement
Infiniti_Inter

Untitled

Mar 28th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <string>
  4. using namespace std;
  5. template <typename X>
  6. inline X abs(const X &a) { return a < 0 ? -a : a; }
  7.  
  8. string convert(char c){
  9.     int t = int(c);
  10.     string res = "";
  11.     while (t){
  12.         res += '0'+(t%10);
  13.         t /= 10;   
  14.         }
  15.     reverse(res.begin(), res.end());
  16.     return res;
  17. }
  18.  
  19.  
  20. int main()
  21. {
  22.     string s;
  23.     cin >> s;
  24.     for(int i = 0; i < s.length(); i++)
  25.     {
  26.         string t = convert(s[i]);
  27.         s.insert(i+1, t);
  28.         i+= t.length();
  29.     }
  30.     cout << s;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement