4 solutions

  • 1
    @ 2025-8-22 15:48:31
    #include<bits/stdc++.h>
    using namespace std;
    const int N=100010;
    string s1,s2;
    int main()
    {
    	while(cin>>s1>>s2)
    	{
    		int n=s1.size();
    		int m=s2.size();
    		int i=0,j=0,cnt=0;
    		while(i<n&&j<m)
    		{
    			if(s1[i]==s2[j])
    			{
    				i++;
    				j++;
    				cnt++;
    			}
    			else
    			{
    				j++;
    			}
    		} 
    		if(cnt==n) cout<<"Yes"<<endl;
    		else cout<<"No"<<endl; 
    	}
    	
    	return 0;
    }
    
    
    

    Information

    ID
    80
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    (None)
    # Submissions
    49
    Accepted
    20
    Uploaded By