Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <iostream>
  2. #pragma warning(disable : 4996)
  3. #include <string>
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9.  
  10. freopen("input.txt", "r", stdin);
  11. freopen("output.txt", "w", stdout);
  12.  
  13.  
  14.  
  15. string str;
  16.  
  17. string sentence = "";
  18.  
  19. while (getline(cin, str)) {
  20. string temp;
  21. for (auto ch1 : str) {
  22. if ((ch1 >= 65) && (ch1 <= 90)) { //big chars
  23. ch1 += 32;
  24. temp += ch1;
  25. }
  26. else if ((ch1 >= 97) && (ch1 <= 122)) { //small chars
  27. temp += ch1;
  28. }
  29. else if ((ch1 >= 48) && (ch1 <= 57)) { //numbers
  30. temp += ch1;
  31. }
  32. else if (ch1 == 32) {
  33. if (!temp.empty()) {
  34.  
  35. if (temp.size() > 3) {
  36. sentence += temp + " ";
  37. }
  38. temp = "";
  39. }
  40.  
  41. }
  42. else if (ch1 == 10 || ch1 == 13) {
  43. sentence += ch1;
  44. }
  45. }
  46.  
  47. }
  48.  
  49. cout << sentence ;
  50.  
  51.  
  52.  
  53. return 0;
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement