-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMini_sub_string.cpp
More file actions
33 lines (28 loc) · 873 Bytes
/
Mini_sub_string.cpp
File metadata and controls
33 lines (28 loc) · 873 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
#include<bits/stdc++.h>
#define ll long long
using namespace std;
/*
Given an string array. You have to make an substring using the characters used in the whole string array such that every string of the string array must be found in the substring and the lenght of the substring must be minimized as low as possible.
string array : abc, abd, abe;
input: abcde;
*/
set<char>st;
void uniqueElement(string p){
for(int i = 0; i < p.size();i++){
st.insert(p[j]);
}
}
int main(){
int n;
cin>>n;
string s[n];
for(int i = 0; i < n; i++){
cin>>s[i];
string p;
p = s[i];
uniqueElement(p);
}
for(auto i = st.begin(); i != st.end(); i++) cout<<*i;
cout<<endl;
return 0;
}