链接:
题意:输入两个字符串S,T,长度小于100000,求出在S中包含T中的最小的那段,例如:
S = "ADOBECODEBANC"T = "ABC"答案是 "BANC". View Code
1 #include2 #include 3 const int M=10005; 4 const int N=100005; 5 char s1[N],s2[N]; 6 int m1[M],m2[M]; 7 int l1,l2; 8 int main(){ 9 int i,j;10 int L,R,len;11 int kind1,kind2;12 while(scanf("%s",s1)!=EOF){13 scanf("%s",s2);14 l1=strlen(s1);15 l2=strlen(s2);16 kind1=kind2=0;17 memset(m1,0,sizeof(m1));18 memset(m2,0,sizeof(m2));19 for(i=0;i m2[s1[j]])){33 m1[s1[j]]--;j++;34 }else break;35 }36 if(flag)37 if(i-j+1