All problems

Problem 332

Minimum Steps to Make Anagram

Easy · 10 pts · String, Hash Table, Counting

Problem

You are given two strings S and T of the same length. In one step you may replace any single character of T with any other character. Find the minimum number of steps needed to make T an anagram of S, that is, a rearrangement of exactly the same letters with the same counts.

Input

Two lines: strings S and T of lowercase letters, with equal lengths.

Output

Print the minimum number of steps.

Constraints

1 <= |S| = |T| <= 100000

Example input

bab
aba

Example output

1

Explanation

S = 'bab' and T = 'aba': T has one 'a' too many and one 'b' too few, so replacing one 'a' in T with 'b' makes it 'bba', an anagram of 'bab'. One step.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Text Justification Next: Longest Substring with At Most K Distinct