STNBD P3 - Rinslet Laurenfrost

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 32M

Author:
Problem type

Rinslet is studying the spirit language. She finds a word that she thinks she has seen before. She would like to find the similarity of the word she found with a word she knows. A word's similarity with another word is defined as the minimum total number of letters you need to add and/or remove from the first word so that it becomes an anagram of the second word.

If you help Rinslet, you might get a taste of her cooking. ♪

Input Specification

Spirit language words are made up of lowercase English letters.

The first line of input will have a word Rinslet already knows.

The second line of input will have the new word.

Output Specification

The first and only line of output should be one integer, the similarity of the words in the input.

Constraints

The lengths of the words will not exceed 100\,000 characters each.

Sample Input

mireille
rinslet

Sample Output

7

Explanation

One possible way to achieve a similarity of 7 is to remove 4 letters and add 3 letters:

m i r e i l l e

(remove m, e, i, l)

t i n r l e s

(add t, n, s)

tinrles is an anagram of rinslet.


Comments


  • -7
    TheVisionnary  commented on March 6, 2020, 3:04 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.