/******************************************
    School: Longfellow Middle School
    Name: Catherine Jeon
    Grade: 8th
    Division: INT-3
    Program Language: C++
******************************************/
#include 
#include 
using namespace std;

int main() {
    ifstream inputFile;
    string filename;
    cout << "Enter the file name: ";
    cin >> filename;
    inputFile.open(filename);
    for(int i = 0; i < 5; i ++){
        string a, b;
        inputFile >> a >> b;
        int val = 1;
        int asf = 0;
        while(val == 1){
            val = 0;
            for(int i = 0; i < a.length() && i < b.length(); i ++){
                if(a[i] == b[i]){
                    a = a.erase(i, 1);
                    b = b.erase(i, 1);
                    i --;
                }
            }
            for(int i = 0; i < a.length() && i < b.length(); i ++){
                if(b[i + 1] == a[i]){
                    b = b.erase(i, 1);
                    val = 1;
                    break;
                }
                if(a[i + 1] == b[i]){
                    a = a.erase(i, 1);
                    val = 1;
                }
            }
        }
        if(a.length() != b.length()){
            asf = a.length() - b.length();
            if(asf < 0){
                asf = asf * -1;
            }
        }
        for(int i = 0; i < a.length() && i < b.length(); i ++){
            asf = asf + (a[i] - b[i]);
        }
        cout << endl << i + 1 << ". " << asf << endl;
    }
}