Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

真的有那么难吗??一次通过,字符串比较

Posted by liuweni at 2007-08-26 15:35:15 on Problem 1936
#include <iostream>
using namespace std;
int main()
{
	string str1,str2;
	int len1,len2,i,j;
	while(cin>>str1>>str2)
	{
		j=0;
		len1 = str1.length();
		len2 = str2.length();
		for(i = 0 ; i < len2 ; i ++)
		{
			if( str1[j] == str2[i])
			{
				j++;
			}
		}
		if(j == len1)
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator