Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void lesson7() {
- map <string, string> dictionary;
- int n;
- cin >> n;
- for (int i = 0; i < n; i++) {
- string key, value;
- cin >> key >> value;
- dictionary[key] = value;
- }
- string search_word;
- cin >> search_word;
- for (auto i : dictionary) {
- if (i.second == search_word) {
- cout << i.first;
- }
- if (i.first == search_word) {
- cout << i.second;
- }
- }
- }
- void lesson6() {
- set <int> numbers_one;
- int n;
- cin >> n;
- for (int i = 0; i < n; i++) {
- int value;
- cin >> value;
- numbers_one.insert(value);
- }
- set <int> numbers_two;
- int m;
- cin >> m;
- for (int i = 0; i < m; i++) {
- int value;
- cin >> value;
- numbers_two.insert(value);
- }
- vector <int> common_numbers;
- for (auto i = numbers_one.begin(); i != numbers_one.end(); i++) {
- if (numbers_two.find(*i) != numbers_two.end()) {
- common_numbers.push_back(*i);
- }
- }
- for (auto i : common_numbers) {
- cout << i << " ";
- }
- }
- void lesson5() {
- set <int> numbers_one;
- int n;
- cin >> n;
- for (int i = 0; i < n; i++) {
- int value;
- cin >> value;
- numbers_one.insert(value);
- }
- set <int> numbers_two;
- int m;
- cin >> m;
- for (int i = 0; i < m; i++) {
- int value;
- cin >> value;
- numbers_two.insert(value);
- }
- int count = 0;
- for (auto i : numbers_one) {
- if (numbers_two.find(i) != numbers_two.end()) {
- count++;
- }
- }
- cout << count;
- }
- void lesson4() {
- set <int> numbers;
- int n;
- cin >> n;
- for (int i = 0; i < n; i++) {
- int value;
- cin >> value;
- if (numbers.find(value) == numbers.end()) {
- cout << "NO" << endl;
- }
- else {
- cout << "YES" << endl;
- }
- numbers.insert(value);
- }
- }
- void lesson3() {
- set <int> numbers;
- int n, count = 0;
- cin >> n;
- for (int i = 0; i < n; i++) {
- int value;
- cin >> value;
- if (numbers.find(value) == numbers.end()) {
- count++;
- }
- numbers.insert(value);
- }
- cout << count;
- }
Advertisement
Add Comment
Please, Sign In to add comment