Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
0MS 1A水啊水~#include <iostream> #include<string> #include<string.h> #include<stdio.h> using namespace std; int main() { //freopen("D:\\CPPProgram\\ACM\\in.txt", "r", stdin); char a[100100], b[100100]; while(~scanf("%s %s", &a, &b)) { int len1, len2; len1 = strlen(a); len2 = strlen(b); if(len1 > len2) { printf("No\n"); } else if(len1 == len2) { if(strcmp(a, b) == 0) printf("Yes\n"); else printf("No\n"); } else { int start = 0; int cnt = 0; int ju; for(int i=0; i<len1; i++) { ju = 0; for(int j=start; j<len2; j++) { if(a[i] == b[j]) { start = j+1; cnt ++; ju = 1; break; } } if(ju == 0) { printf("No\n"); break; } } if(cnt == len1) printf("Yes\n"); } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator