myLoveOnlyForYou

Untitled

Feb 28th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main() {
  7. freopen("input.txt", "r", stdin);
  8. freopen("output.txt", "w", stdout);
  9. char a;
  10. string answer = "";
  11. int word_length = 0;
  12. while (cin.get(a)) {
  13. if ((a >= 'a' && a <= 'z') || (a == ' ') || (a >= 'A' && a <= 'Z') || (a >= '0' && a <= '9')) {
  14. if (a != ' ')
  15. word_length++;
  16. if (a >= 'A' && a <= 'Z') {
  17. char ch((int)a + 32);
  18. answer += ch;
  19. }
  20. else
  21. answer += a;
  22. }
  23. if (a == ' ') {
  24. // cout << answer << " " << word_length << endl;
  25. if (word_length <= 3) {
  26. for (int j = 0; j <= word_length; j++)
  27. answer.pop_back();
  28. }
  29. word_length = 0;
  30. }
  31. }
  32. if (word_length <= 3 && word_length > 0)
  33. for (int i = 0; i < word_length; i++)
  34. answer.pop_back();
  35. cout << answer;
  36.  
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment