Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- using namespace std;
- void small(string &a) {
- for (int i = 0; i < a.size(); ++i) {
- if ('A' <= a[i] && a[i] <= 'Z') {
- a[i] = a[i] - 'A' + 'a';
- }
- }
- }
- int main() {
- string a;
- string b;
- getline(cin, a);
- getline(cin, b);
- vector <char> ac;
- vector <char> bc;
- small(a);
- small(b);
- sort(a.begin(), a.end());
- sort(b.begin(), b.end());
- for (int i = 0; i < a.size(); ++i) {
- if (i > 0) {
- if (a[i] == ' ') {
- }
- else if (a[i] != a[i - 1]) {
- ac.push_back(a[i]);
- }
- }
- else {
- ac.push_back(a[i]);
- }
- }
- for (int i = 0; i < b.size(); ++i) {
- if (i > 0) {
- if (b[i] == ' ') {
- }
- if (b[i] != b[i - 1]) {
- bc.push_back(b[i]);
- }
- }
- else {
- bc.push_back(b[i]);
- }
- }
- for (int i = 0; i < ac.size(); ++i) {
- cout << ac[i];
- }
- cout << endl;
- for (int i = 0; i < bc.size(); ++i) {
- cout << bc[i];
- }
- cout << endl;
- if (ac == bc) {
- cout << "YES";
- }
- else {
- cout << "NO";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement