-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlap tu.cpp
More file actions
47 lines (47 loc) · 773 Bytes
/
lap tu.cpp
File metadata and controls
47 lines (47 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
getline(cin,s);
s=" "+s+" ";
vector<string> b;
vector<int> x;
vector<int> y;
for(int i=1;i<s.length();i++){
if(s[i-1]==' '&&s[i]!=' '){
x.push_back(i);
}
else if(s[i-1]!=' '&&s[i]==' '){
y.push_back(i);
}
}
for(int i=0;i<x.size();i++){
string a;
for(int j=x[i];j<y[i];j++){
a.push_back(s[j]);
}
b.push_back(a);
a.clear();
}
vector<string> c;
int flag;
c.push_back(b[0]);
for(int i=0;i<b.size();i++){
for(int j=0;j<c.size();j++){
if(b[i]!=c[j])
flag=1;
else{
flag=0;
break;
}
}
if(flag==1){
c.push_back(b[i]);
}
else
continue;
}
for(int i=0;i<c.size();i++){
cout<<c[i]<<" ";
}
}