#609
Unrated
Find and Replace
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

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 c1c_1 in the string with another English letter c2c_2. For example, given the string aAbBa\texttt{aAbBa}, if Bessie selects c1c_1 as 'a' and c2c_2 as 'B', the given string transforms into BAbBB\texttt{BAbBB}.

Bessie is a busy cow, so for each of TT (1T101\le T\le 10) independent test cases, output the minimum number of keystrokes required to transform her input string into her desired output string.

입력

The first line contains TT, the number of independent test cases.

The following TT 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 10510^5.

출력

For each test case, output the minimum number of keystrokes required to change the input string into the output string, or 1-1 if it is impossible to do so.

예제 입력 1

4
abc
abc
BBC
ABC
abc
bbc
ABCD
BACD

예제 출력 1

0
-1
1
3

점수

Inputs 2-6: Every string has a length at most 5050.Inputs 7-9: All strings consist only of lowercase letters 'a\texttt{a}' through 'e\texttt{e}'Inputs 10-15: No additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.