867. K-similar strings
0
Hard
Given two strings that are anagrams of each other, we need to determine the smallest value of k such that s1 and s2 are k-similar. Two strings are considered k-similar if we can swap exactly k characters of s1 to obtain s2.
Input Format
The input consists of a single line containing two strings, s1 and s2.
Output Format
Output the smallest value of k for which s1 and s2 are k-similar.
Example
Input
abc
bca
Output
2
Constraints
1 <= s1.length <= 20
s2.length == s1.length
s2.length == s1.length
Loading...
View Submissions
Console