Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (getline(cin, str)) {
- string answer = "";
- int word_length = 0;
- for (char& a : str) {
- 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();
- if (counter == 0)
- first_answer = answer;
- else
- second_answer = answer;
- counter++;
- cout << answer << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement