Home => ProblemSet => 2.12-60:String painter
Problem1897--2.12-60:String painter

1897: 2.12-60:String painter

Time Limit: 1 Sec  Memory Limit: 128 MB  Submit: 0  Solved: 7
[ Submit ] [ Status ] [ Creator: ][ 参考程序 ]

Description

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?
给定两个长度相等的字符串A、B,由小写字母组成。
一次操作,允许把A中的一个连续子串(区间)都转换为某个字符(就像用刷子刷成一样的字符)。
要把A转换为B,问最少操作数是多少?


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.
包含多个测试数据。
每个测试数据由两行组成,第一行包含字符串A,第二行包含字符串B。
两个字符串长度都不超过100。

Output

A single line contains one integer representing the answer。
每行一个数,表示该测试数据对应答案

Sample Input Copy

zzzzzfzzzzz
abcdefedcba
abababababab
cdcdcdcdcdcd

Sample Output Copy

6
7

Source/Category