fork download
  1. #include<iostream>
  2. #include<string>
  3. #include<algorithm>
  4. #include<cmath>
  5. #include<string.h>
  6. #include<vector>
  7. #include<stack>
  8. #include<queue>
  9. #include<map>
  10. #include<set>
  11. #include<cstring>
  12. #include<cstdlib>
  13. #include<iomanip>
  14. #include <climits>
  15. #include<cstdio>
  16. using namespace std;
  17.  
  18. int main()
  19. {
  20. string a[10240] = {};
  21. int next1[10240] = {};
  22. char b[12040] = {};
  23. char tmp[10240] = {};
  24. next1[0] = 0;
  25.  
  26. long long k = 1;
  27.  
  28.  
  29. int flag = 0;
  30. while (gets(b)){
  31. long long l = 0;
  32. long long sum = 0;
  33. if (b[0] == '0'&&strlen(b) == 1){
  34. break;
  35. }
  36.  
  37. for (int i = 0; b[i]; i++){
  38. if (b[i] >= 'a'&&b[i] <= 'z' || (b[i] >= 'A'&&b[i] <= 'Z'))
  39. {
  40. cout << b[i];
  41. tmp[l] = b[i];
  42. l++;
  43. if (b[i + 1] == '\0'){
  44. if (tmp[0]){
  45. a[k] = tmp;
  46. next1[k] = next1[0];
  47. next1[0] = k;
  48. k++;
  49. l = 0;
  50. memset(tmp, 0, sizeof(tmp));
  51. }
  52. }
  53. }
  54. else if (b[i] >= '0'&&b[i] <= '9'){
  55. sum = sum * 10 + b[i] - '0';
  56. if (b[i + 1] == '\0' || b[i + 1]<'0' || b[i]>'9'){
  57. int ti = 1;
  58. int ch = 0;
  59. for (int w = next1[0]; w != 0; w = next1[w]){
  60. if (ti == sum){
  61. cout << a[w];
  62. ch = w;
  63. break;
  64. }
  65. ti++;
  66. }
  67. int no;
  68. if (sum!= 1&&sum!=0){
  69. for (int w = next1[0]; w != 0; w = next1[w]){
  70. if (next1[w] == ch){
  71. no = w;
  72. break;
  73. }
  74. }
  75. next1[no] = next1[ch];
  76. next1[ch] = next1[0];
  77. next1[0] = ch;
  78. }
  79. sum = 0;
  80. }
  81. }
  82. else{
  83. cout << b[i];
  84. if (tmp[0]){
  85. a[k] = tmp;
  86. next1[k] = next1[0];
  87. next1[0] = k;
  88. k++;
  89. l = 0;
  90. memset(tmp, 0, sizeof(tmp));
  91. }
  92. }
  93. }
  94. cout << endl;
  95. }
  96. return 0;
  97. }
Success #stdin #stdout 0s 2848KB
stdin
Greetings, my friends...

It has been a great semester for me, Leo, also 4 Kevin and Eric. We begin this 11 to help all of you in Data Structure course.
I do hope that everything we have learnt 25 20 20 will come 22 fruition. 25 know 14 probably, 23 are struggling 25 our class.
But believe 39, 46 46, there is no rainbow without rain. Now, 19, 19 26 think 29 challenge as 53 pain. 21 then, 10 10
see how fun it 21 36 41 something challenging once 34 17 while. 24, 24, 17 17 24 38 47 47 shared 12 the 53 20
nothing. 27, 54 54 54, 13 one day, 36 11 18 61 20 7 future. 53 62 31 70 21 your position, 3 54 third 61.
10 71 experienced 28 struggle 41 14 38 better grade. 30, 76, expect 30 whatever 38 38 21 15 64 so far made some valid points
21 35. That 15 15 78 together 11 an impact 10 36 knowledge. As 46 36 coming 7 32 close, 31 34 42 grading 44 14
activities 32 44 50 32 32, 93 13 51 54 30 66 takes 21 54 35 pass 27 15. 58 93 3, 37 26 10 be fair 3 everyone.
So, 68, 95 47 12 16 8 not show 32 eagerness 5 learn 29 3 make yourself 41 good 61 17 33 14 28 57 27.
22 35 76 34 75 time 27 us 20 7 21 reconsider 6 what 35 35 done 5 38 53. 16 79 67 6 21 55 7, 36 26
36 38 efforts, 19 35 35 35 71 78. Sometimes, problems 24 face 108 difficult, but 25 109 25 24 answer 37 simple.
68 8 33 finished 111 thesis, 5 39 40 myself. 4 used 4 104 8 8 107 28 very, 1 impossible problem, 23 now, 13 start 13 realize
25 53 24 just another 26 project 7 34 23 11 finish every 49. 16 48 soon 39 greater 41, more 41 tasks,
49 4 complex things. And again, 20 91 86. This 29 41 final letter 42 100 undergraduate student, 41 78 9 9 132 69 68!
14 13 14 69 36 50 101, yet 73 7 46 62 beginning. Further, 14 40 39 49 19, 36 3. Find 90 way 19
13 top. Here 17 27 advice, 12 124 4 favorite saying: If 20 find 148 16, 83 133. 56 25 72 46 102 11 later, at 24 outside world.

141, 4 84 29 38 34 29 "49".
0
stdout
Greetings, my friends...

It has been a great semester for me, Leo, also for Kevin and Eric. We begin this semester to help all of you in Data Structure course.
I do hope that everything we have learnt for this semester will come to fruition. We know that probably, you are struggling in our class.
But believe me, my friends, there is no rainbow without rain. Now, probably, you will think this challenge as a pain. But then, you will
see how fun it is to have something challenging once in a while. Now, probably, you will think that everything we shared in the course is
nothing. But, I do hope, that one day, this course will help you one future. We all have been in your position, in our third semester.
We also experienced the struggle to have a better grade. I, Leo, expect that whatever we shared in the class so far made some valid points
to you. That whatever we learnt together made an impact to your knowledge. As this semester coming to a close, I have been grading all your
activities in our course so far, and I will do whatever it takes to help you pass this course. But of course, we have to be fair to everyone.
So, probably, for some of you to not show your eagerness to learn and to make yourself a good grade probably will not pass the course.
So I think it is time for us to think and reconsider for what we have done for this semester. I hope that for the coming semester, you will
show some efforts, and make yourself a better future. Sometimes, problems we face are difficult, but I believe that the answer is simple.
As I have finished my thesis, I think to myself. I used to see my thesis as a very, very impossible problem, but now, I start to realize
that it is just another simple project that we used to finish every semester. I will soon face greater problems, more difficult tasks,
and more complex things. And again, we all do. This is my final letter as an undergraduate student, but not my final challenge for you!
This letter is coming to a close, yet this is just the beginning. Further, you will face another challenge, and another. Find your way to
the top. Here is my advice, and also my favorite saying: If you find no way, make one. I will see all of you later, at the outside world.

Now, the answer to this challenge is "student".