Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 397ed3c

Browse files
C++ IMPLEMENTATION OF 205
1 parent ad82b97 commit 397ed3c

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
class Solution
5+
{
6+
public:
7+
string mp(string s)
8+
{
9+
map<char, int> m;
10+
string ans = "";
11+
for (auto c : s)
12+
{
13+
if (m.find(c) == m.end())
14+
{
15+
m[c] = m.size();
16+
}
17+
ans += m[c];
18+
}
19+
return ans;
20+
}
21+
bool isIsomorphic(string s, string t)
22+
{
23+
if (mp(s) == mp(t))
24+
{
25+
return true;
26+
}
27+
return false;
28+
}
29+
};
30+
31+
int main()
32+
{
33+
string s, t;
34+
cout << "Enter 2 Strings : ";
35+
cin >> s >> t;
36+
Solution sol;
37+
if (sol.isIsomorphic(s, t))
38+
{
39+
cout << "True";
40+
}
41+
else
42+
{
43+
cout << "False";
44+
}
45+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /