1981: [USACO 2023 January Contest Silver] Problem 1. Find and Replace
题目描述
Bessie is using the latest and greatest innovation in text-editing software, miV! She starts with an input string consisting solely of upper and lowercase English letters and wishes to transform it into some output string. With just one keystroke, miV allows her to replace all occurrences of one English letter in the string with another English letter . For example, given the string
, if Bessie selects as 'a' and as 'B', the given string transforms into .Bessie is a busy cow, so for each of () independent test cases, output the minimum number of keystrokes required to transform her input string into her desired output string.
输入
The following pairs of lines contain an input and output string of equal length. All characters are upper or lowercase English letters (either A through Z or a through z). The sum of the lengths of all strings does not exceed .
输出
样例输入
4
abc
abc
BBC
ABC
abc
bbc
ABCD
BACD
样例输出
0
-1
1
3
提示
The first input string is the same as its output string, so no keystrokes are required.
The second input string cannot be changed into its output string because Bessie cannot change one '
' to ' ' while keeping the other as ' '.The third input string can be changed into its output string by changing '
' to ' '.The last input string can be changed into its output string like so:
SCORING:
- Inputs 2-6: Every string has a length at most .
- Inputs 7-9: All strings consist only of lowercase letters ' ' through ' '
- Inputs 10-15: No additional constraints.