Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <queue>
- #include <fstream>
- #include <iostream>
- #include <cstdio>
- #include <cctype>
- #include <string>
- #define IS_DELIM (c == ' ' || c == '\t' || c == '\n')
- using namespace std;
- int main(void) {
- ifstream in ("input.txt");
- ofstream out ("output.txt");
- queue<string> small;
- queue<string> big;
- queue<char> current;
- char c;
- while (in >> noskipws >> c)
- {
- current.push(c);
- }
- bool begin = true;
- string s;
- while (current.size())
- {
- c = current.front();
- current.pop();
- if (!IS_DELIM)
- {
- begin = false;
- s += c;
- }
- else if (s.size())
- {
- if (islower(s[0])) small.push(s);
- else big.push(s);
- s.clear();
- begin = true;
- }
- }
- while (small.size())
- {
- out << small.front() << " ";
- small.pop();
- }
- while (big.size())
- {
- out << big.front() << " ";
- big.pop();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment