Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <time.h>
- using namespace std;
- #define SZ(x) (int)(x.size())
- #define int long long
- bool cnt[26], aux[26];
- int32_t main(){
- srand(time(0));
- int n;
- cin >> n;
- string s;
- cin >> s;
- for(int i = 0; i < SZ(s); ++i)cnt[s[i]-'a'] = 1;
- for(int i = 1; i < n; ++i){
- cin >> s;
- memset(aux, 0, sizeof(aux));
- for(int j = 0; j < SZ(s); ++j){
- aux[s[j]-'a'] = 1;
- }
- for(int j = 0; j < 26; ++j){
- cnt[j] &= aux[j];
- }
- }
- int ans = 7122;
- for(int i = 0; i < 26 && ans == 7122; ++i){
- if(cnt[i] == 1)ans = i;
- }
- if(ans == 7122)cout << ans << '\n';
- else cout << char(ans + 'a') << '\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement