/*
Andy Chen
Feb 3 2020
Int5
Enloe
Potter
*/

#include 
#include 
#include 
#include 
using namespace std;

vector  word1;
vector  word2;

void ReadIn()
{
    string w1;
    string w2;
    ifstream infile;
    infile.open("D:\\CompSci2\\Files\\ACSL2.txt", ifstream::in);
    if (infile.is_open())
    {
        while (infile.good())
        {
            getline(infile, w1);
            getline(infile, w2);
        }
    }

    int length1 = w1.length();
    int length2 = w2.length();
    for (int i = 0; i < length1; i++)
        word1.push_back(w1[i]);
    for (int i = 0; i < length2; i++)
        word2.push_back(w2[i]);
}

void Print()
{
    for (int i = 0; i < word1.size(); i++)
        cout << word1[i];
    cout << endl;
    for (int i = 0; i < word2.size(); i++)
        cout << word2[i];
    cout << endl;
}

void Sort1()
{
    int length = 0;
    if (word2.size() < word1.size())
        length = word2.size();
    else
        length = word1.size();

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

}

void Sort2()
{
    int length = 0;
    if (word2.size() < word1.size())
        length = word2.size();
    else
        length = word1.size();

    for (int i = 0; i < length - 1; i++)
    {

        if (word1[i] == word2[i+1])
        {
            word2.erase(word2.begin() + i);
            word1.erase(word1.begin() + i);
            word2.erase(word2.begin() + i);
            if (length == word2.size() + 2)
                length -=2;
            else
                length--;
            i--;
            Sort1();
        }

        if (word2[i] == word1[i + 1])
        {
            word1.erase(word1.begin() + i);
            word2.erase(word2.begin() + i);
            word1.erase(word1.begin() + i);

            if (length == word1.size() + 2)
                length -=2;
            else
                length--;
            i--;
            Sort1();
        }
    }
}

int main()
{
    ReadIn();
    //Print();
    Sort1();
    //Print();
    Sort2();
    //Print();
    int sum = 0;
    int extra = 0;
    int length = 0;
    if (word2.size() < word1.size())
    {
        length = word2.size();
        extra = word1.size() - word2.size();
    }
    else if (word1.size() < word2.size())
    {
        length = word1.size();
        extra = word2.size() - word1.size();
    }
    else
        length = word1.size();
    for (int i = 0; i < length; i++)
        sum += word1[i] - word2[i];

    sum += extra;
    cout << sum << endl;

    return 0;
}