fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <stdlib.h>
  4. #include <sstream>
  5. #include <cstdio>
  6. #include <algorithm>
  7. #include <functional>
  8. #include <cctype>
  9. #include <locale>
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15. string s,n="001",m="0";
  16. char p[10000];
  17. int i=0,a,b,c,d,re=0,g=0;
  18. while(getline(cin,s))
  19. {
  20. if(s=="")
  21. {
  22. cout<<endl;
  23. }
  24. else
  25. {
  26. for (std::string::reverse_iterator rit=s.rbegin(); rit!=s.rend(); ++rit)
  27. {
  28. p[i]=*rit;
  29. i++;
  30. }
  31. for(int j=0;j<s.length();j++)
  32. {
  33. if((p[j]>64 && p[j]<91) || (p[j]>96 && p[j]<123) || p[j]==32 || p[j]==33 || p[j]==44|| p[j]==46|| p[j]==58 || p[j]==59 || p[j]==63 )
  34. {
  35. a=p[j];
  36. for( ; a!= 0 ; )
  37. {
  38. re = re * 10;
  39. re = re + a%10;
  40. a = a/10;
  41. }
  42. if(re<10)
  43. {
  44. if(re==1)
  45. cout<<n;
  46. else
  47. cout<<m<<re;
  48. re=0;
  49. }
  50. else
  51. cout<<re;
  52. re=0;
  53. }
  54. else
  55. {
  56. b=p[j]-'0';
  57. b=b*10;
  58. c=p[j+1]-'0';
  59. b=b+c;
  60. j++;
  61. if((b>64 && b<91) || (b>96 && b<100))
  62. {
  63. cout<<(char)b;
  64. }
  65. else if(b==32 || b==33 || b==44|| b==46|| b==58 || b==59 || b==63)
  66. {
  67. if(b==32)
  68. {
  69. cout<<(char)b;
  70. }
  71. else if(b==33)
  72. cout<<(char)b;
  73. else if(b==44)
  74. cout<<(char)b;
  75. else if(b==46)
  76. cout<<(char)b;
  77. else if(b==58)
  78. cout<<(char)b;
  79. else if(b==59)
  80. cout<<(char)b;
  81. else if(b==63)
  82. cout<<(char)b;
  83. }
  84. else
  85. {
  86. b=b*10;
  87. d=p[j+1]-'0';
  88. j++;
  89. b=b+d;
  90. cout<<(char)b;
  91. }
  92. }
  93. }
  94. cout<<endl;
  95. i=0;
  96. }
  97. }
  98. return 0;
  99. }
Success #stdin #stdout 0s 3436KB
stdin
zyxwvnPQST abracadarbra
r!:Y?.!Fx?;rm;PS
One is to write an encoderdecoder program here.
To B or not TO be is the QUESTION.
the quick brown fox jumped over the lazy dog :p
Try all the silly cases you can think of
stdout
794118941179001799979411897923483818081181191121121221
38089590141195362107336436988533411
64101411101401239017941130111141121123411101001111991010014111010011119911101231179231016115014119112311161123511501231011197
6487973748389658182310140161123511501231018923974823611111112341111123662311148
211852330111100123121221798012310140161123411101811111230011012119017116012321111201231191111141189237019950171131123101401611
20111123701115014016112311799923711111121235111015117999231218018015015112310140161123801801792312141148