fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int s;
  10. string ss;
  11. cout << "Enter encrypted code ";
  12. cin >> ss;
  13. string a[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
  14. int l = 0;
  15. string sas = ss.substr(0,1);
  16. string b;
  17. while(sas != NULL) {
  18. if(sas == " ") {
  19. b += " ";
  20. l += 1;
  21. sas = ss.substr(l,1);
  22. }
  23. stringstream sss(sas);
  24. sss >> s;
  25. if(s == 0) {
  26. l += 1;
  27. sas = ss.substr(l,2);
  28. stringstream sss(sas);
  29. sss >> s;
  30. l += 1;
  31. }
  32. b += a[s-1];
  33. l += 1;
  34. sas = ss.substr(l,1);
  35. }
  36. cout << endl << b;
  37. }
Success #stdin #stdout 0.01s 5280KB
stdin
9 0120150225 025015021 019015 01302138
stdout
1;