也是83 #include <iostream> #include <vector> #include <map> using namespace std; int solve(string S,string T) {     int num=0;          for(int i=0;i<=int(S.size()-T.size());i++)     {         map<char,char> m1;         map<char,char> m2;                  auto tmp=S.substr(i,T.size());         bool flag=true;         for(int j=0;j<T.size();j++)         {             if(m1.count(tmp[j]))             {                 if(m1[tmp[j]]!=T[j])                 {                     flag=false;                     break;                 }             }             else             {                 if(m2.count(T[j]))                 {                     if(m2[T[j]]!=tmp[j])                     {                         flag=false;                         break;                     }                 }                 else                 {                     m1[tmp[j]]=T[j];                     m2[T[j]]=tmp[j];                 }             }         }         if(flag)         {             num++;         }     }     return num; } int main() {     int res;     string _S;     getline(cin,_S);     string _T;     getline(cin,_T);          res=solve(_S,_T);     cout<<res<<endl;          return 0;      }
点赞 评论

相关推荐

04-09 09:47
门头沟学院 Java
Arbelite_:2-3k,这工资还不如去摇奶茶
点赞 评论 收藏
分享
牛客网
牛客企业服务