There are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the painter, you can change a segment of characters of a string to any other character you want. That is, after using the painter, the segment is made up of only one kind of character. Now your task is to change A to B using string painter. What’s the minimum number of operations?
input
Input contains multiple cases. Each case consists of two lines:
The first line contains string A.
The second line contains string B.
The length of both strings will not be greater than 100.
Output
A single line contains one integer representing the answer.
Examples
input
1 2 3 4
zzzzzfzzzzz abcdefedcba abababababab cdcdcdcdcdcd
output
1 2
6 7
Tutorial
空白串转B串
暴力原型,以 i 为起点向后枚举终点把区间内的点都染成 B[i],总共有 n! 种方案。
剪枝优化,1 为起点时终点为 n,其他 i 点为起点时若已被染成 B[i],则跳过该点。
分类标准,若最终 n 点被其他起点的染色区域覆盖,则该区间可分为多段子区间,否则表明 B[1]=B[n],且 n 点可从该区间去掉。