第一题和@沉思的橙子 说的一样,用set塞,去重。
第二题可以做一个编码的映射表,扫一遍就行。
if (s.size() != t.size()) return false;
char dict[128] = {0};
for (int i = 0;i < s.size(); ++i) {
    if (dict[s[i]] == 0) dict[s[i]] = t[i];
    else if (dict[[si]] != t[i]) return false;
}
return true;