-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathbasics.cpp
More file actions
58 lines (56 loc) · 1.13 KB
/
basics.cpp
File metadata and controls
58 lines (56 loc) · 1.13 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
/*
void print_subsets(int * arr, int n, string s = string(""))
{
if(n == 0)
{
cout<<s<<endl;
return;
}
print_subsets(arr+1, n-1, s+to_string(arr[0])+string(" "));
print_subsets(arr+1, n-1, s);
return;
}
*/
int main ()
{
string a, b;
cin>>a;
cin>>b;
map<char, int> ma, mb;
string::iterator it;
map<char, int>::iterator mit;
for(it = a.begin(); it != a.end(); it++)
{
ma[(*it)]++;
}
for(it = b.begin(); it != b.end(); it++)
{
mb[(*it)]++;
}
int u = 1;
// cout<<"String a is "<<a<<" and string b is "<<b<<endl;
if(ma.size() == mb.size())
{
u = 0;
for(mit = ma.begin(); mit != ma.end(); mit++)
{
if(mb[mit->first] != ma[mit->first])
{
// cout<<"For character "<<(mit->first)<<" both are not equal"<<endl;
u = 1;
break;
}
}
}
if(u != 0)
cout<<"False"<<endl;
else
cout<<"True";
}