文章
34
粉丝
89
获赞
3
访问
20.6k
#include<cstdio> #include<iostream> #include<string> #include<map> using namespace std; map<char,int> myMap = { {'a',1}, {'b',2},{'c',3},{'d',4},{'e',5} ,{'f',6},{'g',7},{'h',8},{'i',9},{'j',10},{'k',11} ,{'l',12},{'m',13},{'n',14},{'o',15},{'p',16},{'q',17} ,{'r',18},{'s',19},{'t',20},{'u',21},{'v',22} ,{'w',23},{'x',24},{'y',25},{'z',26} }; bool isEqual(string s1,string s2){ int word1[27] = {0}; int word2[27] = {0}; for(int i = 0;i < s1.size();i++){ word1[myMap[s1[i]]]++; } for(int i = 0;i < s2.size();i++){ word2[myMap[s2[i]]]++; } for(int i = 1;i < 27;i++){ if(word1[i] != word2[i]){ return false; } ...
登录后发布评论
暂无评论,来抢沙发