Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #pragma warning(disable : 4996)
- #include <string>
- using namespace std;
- int main()
- {
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- string str;
- string sentence = "";
- while (getline(cin, str)) {
- string temp;
- for (auto ch1 : str) {
- if ((ch1 >= 65) && (ch1 <= 90)) { //big chars
- ch1 += 32;
- temp += ch1;
- }
- else if ((ch1 >= 97) && (ch1 <= 122)) { //small chars
- temp += ch1;
- }
- else if ((ch1 >= 48) && (ch1 <= 57)) { //numbers
- temp += ch1;
- }
- else if (ch1 == 32) {
- if (!temp.empty()) {
- if (temp.size() > 3) {
- sentence += temp + " ";
- }
- temp = "";
- }
- }
- else if (ch1 == 10 || ch1 == 13) {
- sentence += ch1;
- }
- }
- }
- cout << sentence ;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement