Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <queue>
- #include <stack>
- using namespace std;
- int main(){
- string str;
- int n = 0;
- queue <char> arr_queue[100];
- stack <char> arr_stack[100];
- cin >> str;
- string::iterator it = str.begin();
- while (it != str.end())
- {
- while (*it >= 65 && *it <= 90 && it != str.end())
- {
- arr_queue[n].push(*it);
- it++;
- }
- while (*it >= 91 && *it <= 122 && it != str.end())
- {
- arr_stack[n].push(*it);
- it++;
- }
- n++;
- }
- for(int i = 0; i < n; i++)
- {
- while (!arr_queue[i].empty()){
- cout << arr_queue[i].front();
- arr_queue[i].pop();
- }
- while (!arr_stack[i].empty()){
- cout << arr_stack[i].top();
- arr_stack[i].pop();
- }
- }
- return 0;
- }
- //a1b1a2b2a3b3...anbn
- //ABCDEabcdeABCDEabcde
- //a = 91 z = 122 b
- //A = 65 Z = 90 a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement