/* Thomas Celuzza, 11th Grade 
 * Tantasqua Regional High School
 * ACSL 2019-2020 Contest 2, Intermediate 5 Divison
 */
 
import java.util.Scanner;

public class ACSL_Contest2_19_20 {
   public static void main(String[] args) {
      Scanner input = new Scanner(System.in);
      for (int i = 1; i <= 5; i++) {
         String str1 = input.next();
         String str2 = input.next();
         
         // lengths of strings
         int len1 = str1.length();
         int len2 = str2.length();
         
         boolean removed = false;
         int j = 0;
         
         while (j < Math.min(len1, len2)) {
            // Check for matched pairs in whole string each time after you remove a letter to shift the strings
            for (int k = 0; k < Math.min(len1, len2); k++) {
               if (str1.charAt(k) == str2.charAt(k)) {
                  str1 = str1.substring(0, k) + str1.substring(k + 1);
                  str2 = str2.substring(0, k) + str2.substring(k + 1);
                  k--; // since you removed a letter, decrease the counter
                  removed = true;
                  len1 = str1.length();
                  len2 = str2.length();
               }
            }
            if (j < len2 - 1 && str1.charAt(j) == str2.charAt(j + 1)) { // remove a letter from the second string
               str1 = str1.substring(0, j) + str1.substring(j + 1);
               str2 = str2.substring(0, j) + str2.substring(j + 2);
               j--; // since you removed a letter, decrease the counter
               removed = true;
            } else if (j < len1 - 1 && str1.charAt(j + 1) == str2.charAt(j)) { // remove a letter from the first string
               str1 = str1.substring(0, j) + str1.substring(j + 2);
               str2 = str2.substring(0, j) + str2.substring(j + 1);
               j--; // since you removed a letter, decrease the counter
               removed = true;
            }
            
            // recalculate the lengths of the strings
            len1 = str1.length();
            len2 = str2.length();
            j++;
            
            // go back to the beginning of the strings if any letters were removed
            if (j >= Math.min(len1, len2) && removed) {
               j = 0;
               removed = false;
            }
         }
         
         int sum = 0;
         for (int k = 0; k < Math.min(len1, len2); k++) { // loop through and compare each letter
            String a = str1.substring(k, k + 1);
            String b = str2.substring(k, k + 1);
            sum += a.compareTo(b);
         }
         sum += Math.abs(len1 - len2); // add extra letters from the end
         
         // System.out.println(str1 + " " + str2);
         System.out.println(i + ".  " + sum + "\n");
      }
   }
}

/* sample input
abcdeft abxcgbtzfp
blameablenesses blamelessnesses
mezzamines razzmatazz
abbreviations abbreviators
abcdefghijklmno abkcldzzhqjwwlx
abcdefghijkl abxewfrrh

answers
1
-35
-5
-4
-86
-52
*/