← 返回 doordash 的题目列表K-Anagram (check if two strings are k-anagrams)
类型:online_judge
Problem: Check if Two Strings Are K-Anagrams
Given two strings s and t, and an integer k.
We call s and t k-anagrams if you can perform at most k character replacements on s (each replacement changes a character at some index to any character) such that the resulting string becomes an anagram of t.
Return whether s and t are k-anagrams. Output true or false.
Input Format
One line with string s
One line with string t
One line with integer k
Output Format
Output true or false
Constraints
1 <= len(s), len(t) <= 2 * 10^5
Character set is lowercase English letters a-z
Examples
Example 1
Input:
anagram
mangaar
0
Output:
true
Example 2
Input:
apple
peach
1
Output:
false
Example 3
Input:
bab
aba
1
Output:
true
Example
Input
anagram
mangaar
0
Output
true