You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boom/удаление пробелов.txt

26 lines
531 B

#include <bits/stdc++.h>
using namespace std;
int main()
{
string str;
getline(cin, str);
int flag = 0;
for (int i = 0; i < str.size(); i++){
if (str[i] != ' ') {
cout << str[i];
flag = 1;
}
if (str[i] == ' ' && flag == 0) {
continue;
}
if (str[i] == ' ' && i+1 < str.size() && flag == 1) {
if (str[i+1] != ' ') {
cout << str[i];
}
}
}
return 0;
}