Determine if two strings match
Violence out, attention to the array to open a little bit larger.
The AC code is attached:
1#include <iostream>2#include <cstring>3#include <cstdio>4 using namespacestd;5 6 Chars[100010],t[100010];7 8 intMain () {9 while(cin>>s>>t) {Ten if(Strstr (T,s)) {//directly determine if it is an alphabetic string Onecout<<"Yes"<<Endl; A Continue; - } - intflag,sum=0; the intlens=strlen (s); - intLent=strlen (t); - for(intI=0; i<lens;i++){ -flag=1; + for(intj=0; j<lent;j++) {//Match - if(s[i]==T[j]) { +sum++; Aflag=0; atstrcpy (t,t+j+1);//Remove the extra characters -Lent=strlen (t); - //puts (t); - Break; - } - in } - if(flag) { to Break; + } - } the if(flag) { *cout<<"No"<<Endl; $ Continue;Panax Notoginseng } - if(sum==strlen (s)) { thecout<<"Yes"<<Endl; + } A Else{ thecout<<"No"<<Endl; + } - } $ $ - return 0; -}
UVa 10340 all on all