Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #include <queue>
  4. #include <stack>
  5.  
  6. using namespace std;
  7.  
  8. int main(){
  9. string str;
  10. int n = 0;
  11.  
  12. queue <char> arr_queue[100];
  13. stack <char> arr_stack[100];
  14.  
  15.  
  16. cin >> str;
  17. string::iterator it = str.begin();
  18.  
  19. while (it != str.end())
  20. {
  21. while (*it >= 65 && *it <= 90 && it != str.end())
  22. {
  23. arr_queue[n].push(*it);
  24. it++;
  25. }
  26.  
  27. while (*it >= 91 && *it <= 122 && it != str.end())
  28. {
  29. arr_stack[n].push(*it);
  30. it++;
  31. }
  32. n++;
  33. }
  34.  
  35. for(int i = 0; i < n; i++)
  36. {
  37. while (!arr_queue[i].empty()){
  38. cout << arr_queue[i].front();
  39. arr_queue[i].pop();
  40. }
  41.  
  42. while (!arr_stack[i].empty()){
  43. cout << arr_stack[i].top();
  44. arr_stack[i].pop();
  45. }
  46. }
  47.  
  48. return 0;
  49. }
  50.  
  51.  
  52. //a1b1a2b2a3b3...anbn
  53.  
  54. //ABCDEabcdeABCDEabcde
  55.  
  56. //a = 91 z = 122 b
  57. //A = 65 Z = 90 a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement