//Pranay Koneru
//2/3/2019
//Int5
//Enloe
//Potter

#include 
#include 
#include 
#include 

using namespace std;

vector  w1;
vector  w2;
int length = 0;

void noA()
{
    if (w1.size() < w2.size())
        length = w1.size();
    else
        length = w2.size();

    for (int i = 0; i < length; i++)
    {
        if (w1[i] == w2[i])
        {
            w1.erase(w1.begin() + i);
            w2.erase(w2.begin() + i);
            i--;
            length--;
        }
    }
}

void noB()
{
    for (int i = 0; i < length - 1; i++)
    {
        if (w1[i] == w2[i + 1])
        {
            if (length == w2.size())
                length -=2;
            else
                length--;
            w1.erase(w1.begin() + i);
            w2.erase(w2.begin() + i);
            w2.erase(w2.begin() + i);
            noA();
        }
        else if (w1[i + 1] == w2[i])
        {
            if (length == w1.size())
                length -=2;
            else
                length--;
            w1.erase(w1.begin() + i);
            w1.erase(w1.begin() + i);
            w2.erase(w2.begin() + i);
            noB();
        }
    }
}

int main()
{
    string words[10];
    ifstream infile;
    infile.open("E:\\ACSL 2.txt");
	if (infile.is_open())
    {
        for (int i = 0; i < 10; i++)
            getline(infile, words[i]);
    }

    string temp;
    int counter = 0;
    int len = 0;
    while (counter < 10)
    {
        temp = words[counter];
        len = temp.length();
        for (int i = 0; i < len; i++)
            w1.push_back(temp[i]);
        counter++;
        temp = words[counter];
        len = temp.length();
        for (int i = 0; i < len; i++)
            w2.push_back(temp[i]);
        counter++;


        noA();
        noB();

        for (int i = 0; i < w1.size(); i++)
            cout << w1[i];
        cout << endl;
        for (int i = 0; i < w2.size(); i++)
            cout << w2[i];
        cout << endl;

        int sum = 0;
        int a = 0;
        if (w1.size() > w2.size())
        {
            a = w1.size() - w2.size();
            for (int i = 0; i < w2.size(); i++)
                sum += w1[i] - w2[i];
        }
        else if (w2.size() > w1.size())
        {
            a = w2.size() - w1.size();
            for (int i = 0; i < w1.size(); i++)
                sum += w1[i] - w2[i];
        }
        else
        {
            for (int i = 0; i < w1.size(); i++)
                sum += w1[i] - w2[i];
        }
        sum += a;

        cout << sum << endl;
        w1.erase(w1.begin(),w1.begin() + w1.size());
        w2.erase(w2.begin(),w2.begin() + w2.size());
    }
    return 0;
}