시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB51282270.968%

문제

On her spare time Caitlin loves to do speed typing. Unfortunately Caitlyn was never good at spelling. So what often happens is that Catelin makes a mistake spelling a word, and has to go back and fix her typo. One word in particular that Caitlynn has a hard time spelling is the word mischievous. Catelyn usually spells it mischevious instead. In order to fix this typo, Caytlin needs to do 12 key presses.

Katelin thinks that no matter how much time she puts into speed typing, she will always make mistakes. But maybe she can get better at quickly fixing her mistakes. Katelyn would like you to help her with this.

Suppose that Caytlyn has just written the word $S_1$, but that she should have written $S_2$. Assume that the cursor is initially at the end of $S_1$, and that after fixing the typo, Caitlin needs to place the cursor at the end of $S_2$. Output the fewest number of key presses needed to make $S_1$ into $S_2$.

The keys you are allowed to use are

  • the left and right arrow keys.
  • the back space key.
  • the keys $a, \ldots, z$.

You are not allowed to press back space or the left arrow key when the cursor is all the way to the left. You are also not allowed to press the right arrow key when the cursor is all the way to the right.

입력

The first two lines contain the strings $S_1$ respectively $S_2$. Both $S_1$ and $S_2$ consist only of lowercase English letters, and are between $1$ and $100$ characters long.

출력

Output a single line with the fewest number of key presses needed to make $S_1$ into $S_2$.

예제 입력 1

mischevious
mischievous

예제 출력 1

12

예제 입력 2

cerstermergerd
customer

예제 출력 2

20

예제 입력 3

caitlin
caitlynn

예제 출력 3

5

출처

Contest > KTH Challenge > KTH Challenge 2022 I번

  • 문제를 만든 사람: Björn Martinsson