Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <queue>
- #include <string>
- using namespace std;
- int main() {
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- char a;
- string answer = "";
- int word_length = 0;
- while (cin.get(a)) {
- if ((a >= 'a' && a <= 'z') || (a == ' ') || (a >= 'A' && a <= 'Z') || (a >= '0' && a <= '9')) {
- if (a != ' ')
- word_length++;
- if (a >= 'A' && a <= 'Z') {
- char ch((int)a + 32);
- answer += ch;
- }
- else
- answer += a;
- }
- if (a == ' ') {
- // cout << answer << " " << word_length << endl;
- if (word_length <= 3) {
- for (int j = 0; j <= word_length; j++)
- answer.pop_back();
- }
- word_length = 0;
- }
- }
- if (word_length <= 3 && word_length > 0)
- for (int i = 0; i < word_length; i++)
- answer.pop_back();
- cout << answer;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment