fork download
  1. // In The Name of GOD
  2. #include <algorithm>
  3. #include <iostream>
  4. #include <memory.h>
  5. #include <cstdio>
  6. #include <string>
  7. #include <vector>
  8. #include <queue>
  9. #include <cmath>
  10. #include <list>
  11. #include <map>
  12. #include <set>
  13. #include <time.h>
  14.  
  15. using namespace std;
  16.  
  17. #define int64 long long
  18. #define P pair<int, int>
  19. #define Mod 1000000007LL
  20.  
  21. int n, w, q, l, r,a[100002],b[26]; char c;
  22. string s;
  23. int main(){
  24.  
  25. cin >> w;
  26. for (int o = 1; o <= w; o++)
  27. {
  28. cout << "Case #" << o << ":"<<endl;
  29. cin >> s >> q;
  30. for (int i = 0; i < s.size(); i++)
  31. a[i] = s[i];
  32. for (int i = 0; i < q; i++)
  33. {
  34. cin >> c >> l >> r;
  35. if (c == 'g')
  36. {
  37. for (int j = l; j <= r; j++)
  38. b[a[j] - 'A']++;
  39. for (int j = 0; j < 25; j++)
  40. cout << b[j] << ' ';
  41. cout << b[25] << endl;
  42. memset(b, 0, sizeof b);
  43. }
  44. else
  45. sort(a + l, a +r+1);
  46. }
  47.  
  48. }
  49.  
  50. return 0;
  51. }
  52. ///Havij vru!
Success #stdin #stdout 0s 3732KB
stdin
Standard input is empty
stdout
Standard output is empty