# Isomorphic Strings

class Solution {
public:
bool isIsomorphic(string s, string t) {
map<char, int> mapS1;
int counterS1 = 0;
for(string::iterator iter = s.begin(); iter != s.end(); iter++) {
if(!mapS1.count(*iter)) {
counterS1++;
mapS1[*iter] = counterS1;
}
}
vector<int> arrS1;
for(string::iterator iter = s.begin(); iter != s.end(); iter++) {
arrS1.push_back(mapS1[*iter]);
}

map<char, int> mapS2;
int counterS2 = 0;
for(string::iterator iter = t.begin(); iter != t.end(); iter++) {
if(!mapS2.count(*iter)) {
counterS2++;
mapS2[*iter] = counterS2;
}
}
vector<int> arrS2;
for(string::iterator iter = t.begin(); iter != t.end(); iter++) {
arrS2.push_back(mapS2[*iter]);
}

vector<int>::iterator iterS1, iterS2;
iterS1 = arrS1.begin();
iterS2 = arrS2.begin();
for(; iterS1 != arrS1.end(); ) {
if(*iterS1 != *iterS2)
return false;
iterS1++;
iterS2++;
}
return true;

}
};

#### 205. Isomorphic Strings [easy] (Python)

2016-06-15 14:02:47

#### LeetCode 205. Isomorphic Strings（C++版）

2017-03-31 10:54:17

#### 【LeetCode】205 Isomorphic Strings （c++实现）

2015-07-22 10:29:55

#### LeetCode 205:Isomorphic Strings

2015-05-08 23:06:25

#### 关于LeetCode中Isomorphic Strings一题的理解

2016-09-07 18:31:53

#### leetcode 205: Isomorphic Strings

2015-04-30 04:54:59

#### CoderForces985F-Isomorphic Strings

2018-05-31 00:18:46

#### Codeforces #985F: Isomorphic Strings 题解

2018-05-22 14:39:29

#### leetcode 205 Isomorphic Strings C++

2016-06-05 17:24:17

#### 【LeetCode-205】Isomorphic Strings(C++)

2016-09-09 22:40:50