题目：rnrnA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exists a strictly increasing sequence of indices of X such that for all j = 1,2,...,k, xij = zj. For example, Z = is a subsequence of X = with index sequence <1, 2, 4, 6>. Given two sequences X and Y the problem is to find the length of the maximum-length common subsequence of X and Y.rnrnThe program input is from a text file. Each data set in the file contains two strings representing the given sequences. The sequences are separated by any number of white spaces. The input data are correct. For each set of data the program prints on the standard output the length of the maximum-length common subsequence from the beginning of a separate line.rnrnSample Inputrnrnabcfbc abfcabrnprogramming contest rnabcd mnprnrnSample Outputrnrn4rn2rn0rnrnrnrnrnrnrnrnrnrn一下是我的答案，对这些数据没有错误，但是提交就是wa....rnrnrnrn#includern#includernusing namespace std;rnint main()rnrn string a,b;rn int i,j,alen,blen,cnt,p;rn while(cin>>a>>b)rn rn cnt=0;rn p=0;rn rn alen=a.size();rn blen=b.size();rn for(i=0;i

Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result.rnrnThis year, they decide to leave this lovely job to you. rnrn rnrnInputrnInput contains multiple test cases. Each test case starts with a number N (0 < N <= 1000) -- the total number of balloons distributed. The next N lines contain one color each. The color of a balloon is a string of up to 15 lower-case letters.rnrnA test case with N = 0 terminates the input and this test case is not to be processed.rnrn rnrnOutputrnFor each case, print the color of balloon for the most popular problem on a single line. It is guaranteed that there is a unique solution for each test case.rnrn rnrnSample Inputrn5rngreenrnredrnbluernredrnredrn3rnpinkrnorangernpinkrn0rn rnrnSample Outputrnredrnpinkrnrnrnrn代码如下：rn#includern#includern#includernusing namespace std;rnrnint main()rnrn //freopen("input.txt","r",stdin);rn int N;rn while(cin>>N&&N)rn rn string str[10010];rn int arr[1000];rn memset(arr,0,sizeof(arr));rn int i,j;rn for(i=0;i>str[i];rn if(i==0)rn arr[i]=1;rn elsern rn for(j=0;jarr[j])rn rn k=i;rn rn cout<rn#includern#includernusing namespace std;rnrnint main()rnrn //freopen("input.txt","r",stdin);rn int N;rn while(cin>>N&&N)rn rn string str[10010];rn int arr[1000];rn memset(arr,0,sizeof(arr));rn int i,j;rn for(i=0;i>str[i];rn for(j=0;j<=i;++j)rn rn if(str[i].compare(str[j])==0)rn rn arr[j]++;rn rn rn rn int k;rn for(i=1;iarr[i]?k=j:k=i;rn cout<