Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef int l;
- typedef long long ll;
- #define ft freopen("input.txt", "r", stdin)
- #define ftt freopen("output2.txt", "w", stdout)
- #define loop(a, b) for(int i = a; i < b; i++)
- #define max 100005
- #define PI acos(-1.0)
- int main()
- {
- //ft;
- //ftt;
- char s[max];
- l c = 0;
- while(scanf(" %[^\n]", &s) != EOF){
- if(c != 0) cout << endl;
- l p = strlen(s);
- loop(0, p){
- if(s[i] == 32 && s[i+1] == 32) cout << s[i+1];
- else if((s[i]==32) && (s[i+1] == ',' || s[i+1] == '.')){
- cout << s[i+1];
- }
- else if(s[i] == 32 && s[i-1] == 32) continue;
- else if((s[i] == ',' || s[i] == '.') && s[i-1] != 32) cout << s[i];
- else {
- if ((s[i] != ',' && s[i] != '.')) cout << s[i];
- }
- }
- //cout << endl;
- c++;
- }
- return 0;
- }
- // abc def .
- // abc def .
- // abc , def.
- // abc, def.
- // abc, def, hi.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement