Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <algorithm>
- #include <string>
- #include <set>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- cin.get();
- string s;
- set <char> vse;
- set <char> posl;
- set <char> res;
- for (int i = 0; i < n; i++) {
- if (i == n-1) {
- getline(cin, s);
- for (int j = 0; j < s.length(); j++) {
- if (isalpha(s[j])) {
- posl.insert(s[j]);
- }
- }
- }
- else {
- getline(cin, s);
- for (int j = 0; j < s.length(); j++) {
- if (isalpha(s[j])) {
- vse.insert(s[j]);
- }
- }
- }
- }
- set_difference( posl.begin(), posl.end(), vse.begin(), vse.end(), inserter(res, res.begin())); // собрали все различные элементы
- while (!posl.empty()) {
- cout << *posl.begin() << " ";
- posl.erase(posl.begin());
- }
- cout << endl;
- while (!res.empty()) {
- cout << *res.begin() << " ";
- res.erase(res.begin());
- }
- }
- 4
- What will you do?
- Your ARMS are in your MAGIC CHEST, pooplord!
- You CAPTCHALOGUE them in your SYLLADEX.
- You are neither of these things.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement