Solution to the problem number 10340 of UVA - 10340.

Any questions do not hesitate to contact.

#include <bits/stdc++.h>
#define INF 0x3F3F3F3F
using namespace std;

int main()
{
    string input1,input2;
    while(cin>>input1)
    {
    cin>>input2;
    int T[input1.length()+1][input2.length()+1];
    for(unsigned int i=0; i<=input1.length();i++) T[i][0]=0;
    for(unsigned int i=0; i<=input2.length();i++) T[0][i]=0;

    for(unsigned int i=1; i <= input1.length(); i++)
       for(unsigned int j=1; j <= input2.length(); j++)
       {
           if(input1[i-1]==input2[j-1]) T[i][j]=T[i-1][j-1]+1;
           else T[i][j]=max(T[i-1][j],T[i][j-1]);
       }
    if(T[input1.length()][input2.length()] == input1.length()) cout<<"Yes\n";
    else cout<<"No\n";
    }
    return 0;
}

Don't miss anything.

Keep in touch with Isaac Lozano Osorio!