Rinslet Laurenfrost

View as PDF

Submit solution

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

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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


  • -3
    TheVisionnary  commented on March 5, 2020, 10:04 p.m.

    Damn you really love blade dance don't you?