//Siddharth Rajaraman
//Feb. 4, 2020
//Int5
//Enloe
//Potter
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

ifstream myfile("F:\\2inttest.txt");
void input(vector  &first, vector  &second)
{
  string c;
  string a, b;
  getline(myfile, c);

  a = c.substr(0,c.find(' '));
  b = c.substr(c.find(' ') + 1, c.length());
  //cout << "a: " << a << endl;
  //cout << "b: " << b << endl;

  for (int i = 0; i < a.size(); i++)
  {
    first.push_back(a[i]);
  }
  for (int i = 0; i < b.size(); i++)
  {
    second.push_back(b[i]);
  }
}
void samesize(vector  &first, vector  &second)
{
  if (first.size() > second.size())
  {
    for (int i = 0; i < first.size() - second.size(); i++)
    {
    second.push_back('\n');
    }
  }
  if (first.size() < second.size())
  {
    for (int i = 0; i < second.size() - first.size(); i++)
    {
    first.push_back('\n');
    }
  }
}

void deletesame(vector  &first, vector  &second)
{

  if (first.size() > second.size())
  {
    for (int i = 0; i < first.size() - second.size(); i++)
    {
    second.push_back('\n');
    }
  }
  if (first.size() < second.size())
  {
    for (int i = 0; i < second.size() - first.size(); i++)
    {
    first.push_back('\n');
    }
  }

  for (int i = 0; i < first.size(); i++)
  {
    if (first[i] == second[i])
    {
      first.erase(first.begin() + i);
      second.erase(second.begin() + i);
      i = i-1;

    }
  }
}


void deletebefore(vector  &first, vector  &second)
{
  for (int i = 0; i < first.size() - 1; i++)
  {
    if (first[i] == second[i+1])
    {
      second.erase(second.begin() + i);
      break;
    }
    else if(second[i] == first[i + 1])
    {
      first.erase(first.begin() + i);
      break;
    }
  }
}

void adding(vector  &first, vector  &second, int &sum)
{
  int x = 0;
  if (sum > 0)
  {
    sum = 0;
  }
  for (int i = 0; i < first.size(); i++)
  {
    if ((isalpha(first[i]) != 0) && (isalpha(second[i]) != 0))
    {
    sum += first[i] - second[i];
    }
    else
    {
      x++;
    }
  }
    sum = sum + x;
        cout << sum << endl;
}


int main()
{
  int counter;
  int sum;
  string a, b;
  vector  first, second;
  samesize(first, second);

  for (int j = 0; j < 5; j++)
  {
  first.clear();
  second.clear();
  sum = 0;
  input(first, second);
  for (int i = 0; i < first.size(); i++)
  {
  deletesame(first,second);
  deletebefore(first,second);
  samesize(first, second);
  }
  adding(first, second, sum);
  }

  return 0;
}