# CF1005B Delete from the Left

• 56通过
• 85提交
• 题目来源
• 评测方式 RemoteJudge
• 标签 字符串
• 难度 普及-
• 时空限制 1000ms / 256MB
• 提示：收藏到任务计划后，可在首页查看。

## 题意翻译

你得到两个字符串s和t。在单个移动中，可以选择两个字符串中的任何一个，并删除第一个字符（即最左边的字符）。移动之后，字符串的长度减少了1个1。如果字符串为空，则不能选择它。 例如： 通过向字符串“何处”移动，结果是字符串“在这里”， 通过向字符串“A”移动，结果是一个空字符串“”。 你需要用最少的动作使两个给定的字符串相等。最后，两个字符串都可能等于空字符串，因此，它们是相等的。在这种情况下，答案显然是初始字符串的长度之和。 编写一个程序，找出两个给定字符串s和t相等的最小移动数。

## 题目描述

You are given two strings $s$ and $t$ . In a single move, you can choose any of two strings and delete the first (that is, the leftmost) character. After a move, the length of the string decreases by $1$ . You can't choose a string if it is empty.

For example:

• by applying a move to the string "where", the result is the string "here",
• by applying a move to the string "a", the result is an empty string "".

You are required to make two given strings equal using the fewest number of moves. It is possible that, in the end, both strings will be equal to the empty string, and so, are equal to each other. In this case, the answer is obviously the sum of the lengths of the initial strings.

Write a program that finds the minimum number of moves to make two given strings $s$ and $t$ equal.

## 输入输出格式

输入格式：

The first line of the input contains $s$ . In the second line of the input contains $t$ . Both strings consist only of lowercase Latin letters. The number of letters in each string is between 1 and $2\cdot10^5$ , inclusive.

输出格式：

Output the fewest number of moves required. It is possible that, in the end, both strings will be equal to the empty string, and so, are equal to each other. In this case, the answer is obviously the sum of the lengths of the given strings.

## 输入输出样例

输入样例#1： 复制
test
west

输出样例#1： 复制
2

输入样例#2： 复制
codeforces
yes

输出样例#2： 复制
9

输入样例#3： 复制
test
yes

输出样例#3： 复制
7

输入样例#4： 复制
b
ab

输出样例#4： 复制
1


## 说明

In the first example, you should apply the move once to the first string and apply the move once to the second string. As a result, both strings will be equal to "est".

In the second example, the move should be applied to the string "codeforces" $8$ times. As a result, the string becomes "codeforces" $\to$ "es". The move should be applied to the string "yes" once. The result is the same string "yes" $\to$ "es".

In the third example, you can make the strings equal only by completely deleting them. That is, in the end, both strings will be empty.

In the fourth example, the first character of the second string should be deleted.

提示
标程仅供做题后或实在无思路时参考。
请自觉、自律地使用该功能并请对自己的学习负责。
如果发现恶意抄袭标程，将按照I类违反进行处理。