Transform the String

아직 제출이 없습니다메모리 제한1024 MB

문제

You are given a string SS which denotes a padlock consisting of lower case English letters. You are also given a string FF consisting of set of favorite lower case English letters. You are allowed to perform several operations on the padlock. In each operation, you can change one letter of the string to the one following it or preceding it in the alphabetical order. For example: for the letter c, you are allowed to change it to either b or d in an operation. The letters can be considered in a cyclic order, i.e., the preceding letter for letter a would be letter z. Similarly, the following letter for letter z would be letter a.

Your aim is to find the minimum number of operations that are required such that each letter in string SS after applying the operations, is present in string FF.

입력

The first line of the input gives the number of test cases, TTTT test cases follow.

Each test case consists of two lines.

The first line of each test case contains the string SS.

The second line of each test case contains the string FF.

출력

For each test case, output one line containing Case #x: y, where xx is the test case number (starting from 1) and yy is the minimum number of operations that are required such that each letter in string SS after applying the operations, is one of the characters in string FF.

제한

  • 1T1001≤T≤100.
  • 11≤ the length of S105S≤10^5.
  • SS only consists of lower case English letters.
  • FF only consists of distinct lower case English letters.
  • The letters in string FF are lexicographically sorted.