// Allison Hubbard
// Feb. 30, 2020
// Int5
// Enloe
// Potter
#include 
#include 
#include 
#include 
using namespace std;

void vectorify (string s, vector&v) {
  for (int i = 0; i < s.length(); i++)
    v.push_back(s[i]);
}
int small (vectora, vectorb) {
  int smallsize = 0;
  if (a.size() < b.size())
    smallsize = a.size();
  else
    smallsize = b.size();
  return smallsize;
}
void print (vectoroutput) {
  for(int i = 0; i < output.size(); i++)
    cout << output[i];
  cout << endl;
}

int main() {
  ifstream infile;
  string string1 = "";
  string string2 = "";
  infile.open("F://2inttest.txt", ifstream::in);
  if (infile.is_open()){
  while (infile.good()) {
    infile >> string1 >> string2;
    vectorvec1;
    vectorvec2;
    vectorify(string1, vec1);
    vectorify(string2, vec2);
    int smallsize = small(vec1, vec2);
    bool noMatches = false;
    while (!noMatches) {
      noMatches = true;
      int a = 0;
      while (a < small(vec1, vec2)) {
        if (vec1[a] == vec2[a]) {
          noMatches = false;
          vec1.erase(vec1.begin() + a);
          vec2.erase(vec2.begin() + a);
          a = a - 1;
        }
        a++;
      }
      int b = 0;
      while (b < small(vec1, vec2)-1) {
        if (vec1[b] == vec2[b+1]) {
          noMatches = false;
          vec2.erase(vec2.begin() + b);
          b = small(vec1, vec2);
        }
        else if (vec1[b+1] == vec2[b]) {
          noMatches = false;
          vec1.erase(vec1.begin() + b);
          b = small(vec1, vec2);
        }
        else
          b++;
      }
      smallsize = small(vec1, vec2);
    }
    int ASF = 0;
    for (int s = 0; s < smallsize; s++)
      ASF = ASF + ((int)(vec1[s]) - (int)(vec2[s]));
    if (vec1.size() < vec2.size())
      ASF = ASF + vec2.size() - smallsize;
    else if (vec1.size() > vec2.size())
      ASF = ASF + vec1.size() - smallsize;
    cout << string1 << "    " << string2 << endl;;
    cout << ASF << endl << endl;
    }
  }
  return 0;
}