Given a string str and an integer K, find whether the string can be changed into a pangram after at most k operations. A pangram is a sentence containing every letter in the english alphabet. A single operation can be used to swap an existing alphabetic character with any other alphabetic character.
Example 1:
Input:
str = "the quick brown fox jumps over the lazy dog"
k = 0
Output: 1
Explanation: the sentence contains all 26 characters 
and is already a pangram. 
Example 2:
Input:
str = "aaaaaaaaaaaaaaaaaaaaaaaaaa"
k = 25
Output: 1
Explanation: The word contains 26 instances of 'a'.
Since only 25 operations are allowed. We can keep
1 instance and change all others to make str a pangram.
Your Task:  
You dont need to read input or print anything. Complete the function kPangram() which takes str and k as input parameters and returns a boolean value which denotes if pangram is possible or not.
Expected Time Complexity: O(N) where N is length of str.
Expected Auxiliary Space: O(1)  
Constraints:
1<= N <= 10^{4}
String may contain duplicate characters.
String can contain only lowercase alphabets or space.

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

Starter code: #User function Template for python3



def kPangram(string, k):

    # code here

Solutions:
def kPangram(string, k):
	s = set()
	count = 0
	for i in range(0, len(string)):
		if string[i] >= 'a' and string[i] <= 'z':
			s.add(string[i])
			count += 1
	if count >= 26 and 26 - len(s) <= k:
		return True
	return False


def kPangram(string, k):
	d = [0] * 26
	for i in string:
		if i.isalpha():
			d[ord(i.lower()) - 97] += 1
	l = 0
	i = 0
	while i < 26:
		if d[i] == 1:
			pass
		elif d[i] == 0:
			k -= 1
			l -= 1
		else:
			l += d[i] - 1
		i += 1
	if k >= 0 and l >= 0:
		return True
	return False


def kPangram(string, k):
	c = 0
	freq = {}
	for i in string:
		if i == ' ':
			continue
		if i not in freq:
			freq[i] = 1
		else:
			freq[i] += 1
			c += 1
	if len(freq) == 26:
		return True
	elif len(freq) + c >= 26 and k >= 26 - len(freq):
		return True
	return False


def kPangram(string, k):
	string = ''.join([i for i in string if 'a' <= i <= 'z'])
	if len(string) < 26:
		return 0
	if 26 - len(set(string)) <= k:
		return 1
	return 0


def kPangram(string, k):
	s = ''
	for i in string:
		if i != ' ':
			s += i.lower()
	if len(s) < 26:
		return False
	s = list(s)
	s.sort()
	count = 0
	al = 'abcdefghijklmnopqrstuvwxyz'
	for i in al:
		if i not in s:
			count += 1
	if count > k:
		return False
	return True


def kPangram(string, k):
	string = string.replace(' ', '')
	if len(string) < 26:
		return False
	d = {}
	for i in string:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	present = len(d)
	absent = 26 - present
	if absent <= k:
		return True
	return False


def kPangram(string, k):
	string = string.replace(' ', '')
	if len(string) < 26:
		return 0
	char_dict = {}
	for char in string:
		if char in char_dict:
			char_dict[char] = char_dict[char] + 1
		else:
			char_dict[char] = 1
	present_list = len(char_dict)
	absent_list = 26 - present_list
	if absent_list <= k:
		return 1
	else:
		return 0


def kPangram(string, k):
	curr = 26
	string = string.replace(' ', '')
	n = len(string)
	if n < 26:
		return False
	alphabet = [1] * 128
	for i in range(n):
		if string[i] == ' ':
			continue
		if alphabet[ord(string[i])] == 1:
			curr -= 1
			alphabet[ord(string[i])] -= 1
			if curr <= k:
				return True
	if curr <= 0:
		return True
	else:
		return False


def kPangram(string, k):
	s = string.replace(' ', '')
	cou = 0
	if len(s) < 26:
		return False
	else:
		let = 'abcdefghijklmnopqrstuvwxyz'
		for i in let:
			if i in s:
				cou += 1
		if cou == 26:
			return True
		else:
			rem = 26 - cou
			ans = len(s) - cou
			if ans >= rem and k >= rem:
				return True
			else:
				return False


import string

def kPangram(string, k):
	l = []
	for i in string:
		if i != ' ':
			l.append(i)
	s = set(l)
	l1 = list(s)
	if 26 - len(l1) <= k and len(l) >= 26:
		return True
	return False


from collections import Counter

def kPangram(string, k):
	c = Counter(string)
	count = 0
	lenght = 0
	for item in c:
		if item.isalpha():
			count += 1
			lenght += c[item]
	return True if lenght >= 26 and count + k >= 26 else False


def kPangram(string, k):
	count = 0
	x = ''
	for i in string:
		i
		if i.isalpha():
			count += 1
			if i not in x:
				x += i
	if count < 26:
		return False
	l = 26 - len(x)
	if l <= k:
		return True
	return False


def kPangram(string, k):
	arr = []
	for x in string:
		if x.isalpha():
			arr.append(x)
	alphabets = set()
	for x in arr:
		alphabets.add(x)
	alphabets_required = 26 - len(alphabets)
	modification_slots_available = len(arr) - len(alphabets)
	if alphabets_required == 0:
		return 1
	elif alphabets_required <= min(k, modification_slots_available):
		return 1
	else:
		return 0


import string

def kPangram(string, k):
	(count, total) = (0, 0)
	s1 = string.replace(' ', '')
	if len(s1) < 26:
		return False
	d = {}
	for i in s1:
		d[i] = d.get(i, 0) + 1
	if len(d) == 26:
		return True
	if 26 - len(d) <= k:
		return True
	else:
		False


def kPangram(string, k):
	c = 0
	cou = 0
	res = set()
	for i in string:
		if i.isalpha():
			cou += 1
			if i not in res:
				res.add(i)
				c += 1
	if 26 - c <= k and cou - c >= 26 - c:
		return 1
	return 0


def kPangram(string, k):
	a = [0] * 26
	al = 0
	for i in range(len(string)):
		if string[i] != ' ':
			a[ord(string[i]) - ord('a')] += 1
			al = al + 1
	if al < 26:
		return 0
	c = 0
	for i in range(26):
		if a[i] > 0:
			c = c + 1
	if 26 - c <= k:
		return 1
	else:
		return 0


def kPangram(string, k):
	S = ''
	st = string.split()
	for i in st:
		S = S + i
	S = S.lower()
	if len(S) < 26:
		return 0
	a = set(S)
	if len(a) + k >= 26:
		return 1
	return 0


def kPangram(k, n):
	c = 0
	for i in k:
		if i != ' ':
			c += 1
	if c < 26:
		return 0
	k = k + ' '
	k = set(k)
	k.discard(' ')
	if len(k) + n < 26:
		return 0
	return 1


def kPangram(string, k):
	ls = [0] * 26
	n = len(string)
	if n < 26:
		return False
	swap = 0
	count = 0
	for i in range(n):
		num = ord(string[i]) - 97
		if num >= 26 or num < 0:
			continue
		if ls[num] > 0:
			swap += 1
		else:
			ls[num] += 1
			count += 1
	if count == 26:
		return True
	if count + min(k, swap) >= 26:
		return True
	return False


def kPangram(string, k):
	cont = 0
	string = string.replace(' ', '')
	if len(string) < 26:
		return False
	lis = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	dic = {}
	for i in string:
		if i not in dic:
			dic[i] = 1
		else:
			dic[i] += 1
	for l in lis:
		if l in dic:
			cont += 1
	if cont + k >= 26:
		return True
	else:
		return False


def kPangram(string, k):
	n = len(string)
	alpha = [0] * 26
	for i in range(n):
		if string[i] >= 'a' and string[i] <= 'z':
			pos = ord(string[i]) - ord('a')
			alpha[pos] += 1
	res = 0
	cnt = 0
	for i in range(26):
		if alpha[i] == 0:
			res += 1
		if alpha[i] > 0:
			cnt += alpha[i]
	if k >= res and cnt >= 26:
		return True
	return False


def kPangram(string, k):
	s = {}
	string = string.replace(' ', '')
	for i in string:
		s[i] = 1
	if len(s) + k >= 26 and len(string) >= 26:
		return 1
	return 0


def kPangram(string, k):
	d = {chr(x): 0 for x in range(ord('a'), ord('z') + 1)}
	remain = 0
	present = 0
	for char in string:
		if char != ' ':
			d[char] = d.get(char) + 1
			present = present + 1
	for v in d.values():
		if v == 0:
			remain = remain + 1
	if present >= 26:
		if remain <= k:
			return 1
		else:
			return 0
	else:
		return 0


def kPangram(string, k):
	a = string.replace(' ', '')
	n = len(set(a))
	if len(a) < 26:
		return 0
	if n == 26 or 26 - n <= k:
		return 1
	else:
		return 0


def kPangram(string, k):
	string = string.replace(' ', '')
	if len(string) < 26:
		return 0
	else:
		co = 0
		l = [False] * 26
		for c in string.lower():
			l[ord(c) - ord('a')] = True
		for i in range(len(l)):
			if not l[i]:
				co = co + 1
		if co <= k:
			return True
		else:
			return False


def kPangram(string, k):
	alpha = len(string) - string.count(' ')
	if alpha < 26:
		return False
	if k > 26:
		return True
	map = [0] * 26
	for c in string:
		if c != ' ':
			map[ord(c) - ord('a')] = 1
	dist = map.count(1)
	if dist + k >= 26:
		return True
	else:
		return False
if __name__ == '__main__':
	T = int(input())
	for tcs in range(T):
		string = input()
		K = int(input())
		if kPangram(string, K):
			print(1)
		else:
			print(0)


def kPangram(string, k):
	s = set()
	cnt = 0
	for i in string:
		if ord(i) in range(97, 97 + 26):
			s.add(i)
			cnt += 1
	if cnt >= 26 and 26 - len(s) <= k:
		return 1
	return 0
if __name__ == '__main__':
	T = int(input())
	for tcs in range(T):
		string = input()
		K = int(input())
		if kPangram(string, K):
			print(1)
		else:
			print(0)


def kPangram(string, k):
	string = ''.join(string.strip().split())
	if len(string) < 26:
		return 0
	cnt = 26
	a = [1] * 128
	for i in range(len(string)):
		if a[ord(string[i])] == 1:
			cnt -= 1
			a[ord(string[i])] -= 1
			if cnt <= k:
				return 1
	if cnt <= 0:
		return 1
	else:
		return 0
if __name__ == '__main__':
	T = int(input())
	for tcs in range(T):
		string = input()
		K = int(input())
		if kPangram(string, K):
			print(1)
		else:
			print(0)


def kPangram(string, k):
	string = string.lower()
	map = {}
	for char in string:
		if char.isalpha():
			if char not in map:
				map[char] = 0
			map[char] += 1
	total_extra = 0
	unique_char = 0
	for key in map:
		unique_char += 1
		total_extra += map[key] - 1
	if unique_char == 26:
		return True
	else:
		transforms_required = 26 - unique_char
		return transforms_required <= total_extra and transforms_required <= k
if __name__ == '__main__':
	T = int(input())
	for tcs in range(T):
		string = input()
		K = int(input())
		if kPangram(string, K):
			print(1)
		else:
			print(0)


def kPangram(string, k):
	d = {}
	count = 0
	c = 0
	n = len(string)
	for m in range(n):
		if string[m] == ' ':
			continue
		else:
			c += 1
	if c < 26:
		return 0
	for i in range(97, 123):
		d[chr(i)] = 0
	for j in range(n):
		if string[j] != ' ':
			d[string[j]] += 1
	for x in d.values():
		if x == 0:
			count += 1
	if count <= k:
		return 1
	else:
		return 0
if __name__ == '__main__':
	T = int(input())
	for tcs in range(T):
		string = input()
		K = int(input())
		if kPangram(string, K):
			print(1)
		else:
			print(0)


def kPangram(string, k):
	alphabets = [0] * 26
	characters = 0
	for i in range(len(string)):
		char = string[i]
		if char != ' ':
			characters += 1
			alphabets[ord(char) - ord('a')] += 1
	if characters < 26:
		return 0
	remaining = 0
	canBeChanged = 0
	for num in alphabets:
		if num == 0:
			remaining += 1
		else:
			canBeChanged += num - 1
	return 1 if remaining <= k else 0
if __name__ == '__main__':
	T = int(input())
	for tcs in range(T):
		string = input()
		K = int(input())
		if kPangram(string, K):
			print(1)
		else:
			print(0)


def kPangram(string, k):
	ls = []
	l = []
	for i in range(len(string)):
		if string[i].isalpha():
			if string[i] in l:
				ls.append(string[i])
			else:
				l.append(string[i])
	m = 26 - len(l)
	if m == 0 or (m <= len(ls) and m <= k):
		return 1
	return 0
if __name__ == '__main__':
	T = int(input())
	for tcs in range(T):
		string = input()
		K = int(input())
		if kPangram(string, K):
			print(1)
		else:
			print(0)


def kPangram(s, k):
	s = s.replace(' ', '')
	n = len(s)
	if n < 26:
		return False
	arr = [False for i in range(26)]
	for i in s:
		if ord(i) >= ord('a') and ord(i) <= ord('z'):
			arr[ord(i) - ord('a')] = True
		elif ord(i) >= ord('A') and ord(i) <= ord('Z'):
			arr[ord(i) - ord('A')] = True
	c = 0
	for ch in arr:
		if ch == False:
			c += 1
	if c == 0:
		return True
	elif c <= k:
		return True
	return False
if __name__ == '__main__':
	T = int(input())
	for tcs in range(T):
		string = input()
		K = int(input())
		if kPangram(string, K):
			print(1)
		else:
			print(0)


def kPangram(s, k):
	s = s.replace(' ', '')
	return 1 if 26 - len(set(s)) <= k and len(s) >= 26 else 0


def kPangram(s, k):
	s = s.replace(' ', '')
	if len(s) < 26:
		return 0
	if len(set(s)) >= 26:
		return 1
	if k >= 25 and len(s) >= 26:
		return 1
	t = len(set(s))
	c = 26 - t
	return 1 if c <= k and len(s) >= 26 else 0


def kPangram(string, k):
	if len(string) - string.count(' ') < 26:
		return False
	if k > 25:
		return True
	arr = [0 for _ in range(26)]
	for ele in string:
		if ele != ' ':
			arr[ord(ele) - ord('a')] = 1
	cnt = arr.count(1)
	if cnt + k >= 26:
		return True
	else:
		return False


def kPangram(string, k):
	li = []
	for i in range(26):
		li.append(False)
	space = 0
	for c in string.lower():
		if not c == ' ':
			li[ord(c) - ord('a')] = True
			space = space + 1
	count = 0
	for ch in li:
		if ch == False:
			count = count + 1
	if k >= count and space >= 26:
		return 1
	else:
		return 0


def kPangram(string, k):
	output = ''
	for i in string.split():
		output += i
	s1 = set(output)
	n1 = len(s1)
	if 26 - n1 <= k and len(output) >= 26:
		return True
	return False


import string

def kPangram(string, k):
	n = len(string) - string.count(' ')
	if n < 26:
		return False
	if k > 25:
		return True
	list = [0] * 26
	for c in string.lower():
		if not c == ' ':
			list[ord(c) - ord('a')] = 1
	A = list.count(1)
	if A + k >= 26:
		return True
	return False


def kPangram(s, k):
	noOfAlpha = len(string) - string.count(' ')
	if noOfAlpha < 26:
		return False
	if k > 25:
		return True
	map = [0] * 26
	for e in string:
		if e != ' ':
			map[ord(e) - ord('a')] = 1
	noOfDistAlpha = map.count(1)
	if noOfDistAlpha + k >= 26:
		return True
	else:
		return False


def kPangram(string, k):
	num = others = 0
	hashmap = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
	for i in string:
		if i in hashmap:
			hashmap[i] += 1
	for l in hashmap:
		if hashmap[l] == 0:
			num += 1
		elif hashmap[l] > 0:
			others += hashmap[l] - 1
	if num > k or num > others:
		return 0
	return 1
if __name__ == '__main__':
	T = int(input())
	for tcs in range(T):
		string = input()
		K = int(input())
		if kPangram(string, K):
			print(1)
		else:
			print(0)


import itertools

def kPangram(string, k):
	string = string.replace(' ', '')
	if len(string) < 26:
		return 0
	arr = [0] * 26
	for i in string:
		if i != ' ':
			arr[ord(i) - 97] = 1
	for i in arr:
		if i != 1:
			k -= 1
	if k >= 0:
		return 1
	else:
		return 0


def kPangram(string, k):
	a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	string = string.casefold()
	string = string.replace(' ', '')
	count = 0
	n = len(string)
	for x in string:
		if x in a:
			a.remove(x)
		count += 1
	if len(a) == 0:
		return 1
	elif n < 26:
		return 0
	elif k >= len(a):
		if len(a) <= count:
			return 1
		else:
			return 0
	else:
		return 0


def kPangram(string, k):
	num = others = 0
	hashmap = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
	for i in string:
		if i in hashmap:
			hashmap[i] += 1
	for l in hashmap:
		if hashmap[l] == 0:
			num += 1
		elif hashmap[l] > 0:
			others += hashmap[l] - 1
	if num > k or num > others:
		return 0
	return 1


def kPangram(s, k):
	set1 = set()
	count = 0
	ct = 0
	for i in range(len(s)):
		if s[i].lower() >= 'a' and s[i].lower() <= 'z':
			set1.add(s[i])
			ct += 1
	if ct >= 26 and 26 - len(set1) <= k:
		return True
	return False


from collections import defaultdict

def kPangram(string, k):
	d = defaultdict(int)
	count = 0
	for s in string:
		if s == ' ':
			continue
		d[s] += 1
		count += 1
	if count < 26:
		return 0
	temp = 26 - len(d.keys())
	if k >= temp:
		return 1
	return 0


import textwrap

def kPangram(string, k):
	val = string
	a = textwrap.wrap(val, 1)
	if len(a) >= 26:
		if len(set(a)) == 26:
			return 1
		else:
			b = len(set(a))
		if k >= 26 - b:
			return 1
		else:
			return 0
	else:
		return 0


def kPangram(string, k):
	uni_alpha = []
	dup = 0
	for ii in range(len(string)):
		if not string[ii] in uni_alpha and (not string[ii] == ' '):
			uni_alpha.append(string[ii])
		elif string[ii] in uni_alpha and (not string[ii] == ' '):
			dup += 1
	if min(dup, k) + len(uni_alpha) >= 26:
		return True
	else:
		return False


def kPangram(string, k):
	n = len(string)
	map_char = {}
	count = 0
	for x in string:
		if x == ' ':
			continue
		count += 1
		if x in map_char:
			map_char[x] += 1
		else:
			map_char[x] = 1
	if count < 26:
		return 0
	return 26 - len(map_char) <= k


def kPangram(string, k):
	string = string.replace(' ', '')
	if len(string) < 26:
		return False
	dict_ = {}
	for i in range(len(string)):
		if string[i] not in dict_:
			dict_[string[i]] = 1
		else:
			dict_[string[i]] += 1
	if 26 - len(dict_) <= k:
		return 1
	else:
		return 0


def kPangram(string, k):
	s = string.replace(' ', '')
	s = str.lower(s)
	l = []
	for i in range(97, 123):
		l.append(chr(i))
	count = 0
	if len(s) < 26:
		return False
	else:
		for i in range(0, len(s)):
			if s[i] in l:
				l.remove(s[i])
			else:
				count = count + 1
		if len(l) <= count and len(l) <= k:
			return True
		else:
			return False


def kPangram(string, k):
	stringTrimmed = string.replace(' ', '')
	if len(stringTrimmed) < 26:
		return 0
	result = []
	count = 0
	for i in range(26):
		result.append(False)
	for char in stringTrimmed:
		result[ord(char.lower()) - ord('a')] = True
	for val in result:
		if val == False:
			count += 1
	if k >= count:
		return 1
	else:
		return 0


from collections import Counter

def kPangram(s1, k):
	s = Counter(s1)
	if abs(len(s1) - s[' ']) < 26:
		return None
	else:
		count = len(s)
		if ' ' in s:
			count = len(s) - 1
		if count == 26:
			return 1
		elif k + count >= 26:
			return 1
		else:
			return None


def kPangram(string, k):
	string = string.lower()
	string = string.replace(' ', '')
	n = len(string)
	if n < 26:
		return False
	if k > 25:
		return True
	set1 = set(string)
	count = 0
	for c in set1:
		if ord(c) >= 97 & ord(c) <= 122:
			count += 1
	if count == 26:
		return True
	elif count + k >= 26:
		return True
	else:
		return False


def kPangram(v, k):
	S = []
	for i in v:
		if i != ' ':
			S.append(i)
	if len(S) < 26:
		return False
	visited = [0] * 26
	for char in S:
		visited[ord(char) - ord('a')] = True
	count = 0
	for i in range(26):
		if visited[i] != True:
			count += 1
	if count <= k:
		return True
	return False


def kPangram(string, k):
	s = set()
	count = 0
	for i in range(len(string)):
		if string[i] >= 'a' and string[i] <= 'z' or (string[i] >= 'A' and string[i] <= 'Z'):
			s.add(string[i])
			count += 1
		if count >= 26 and 26 - len(s) <= k:
			return 1
	return 0


def kPangram(string, k):
	if len(string) < 25:
		return 0
	l = [0] * 26
	for i in range(len(string)):
		asci = ord(string[i].upper()) - 65
		if asci >= 0:
			l[asci] += 1
	count = 0
	extra = 0
	for i in l:
		if i > 1:
			extra += i - 1
		elif i == 0:
			count += 1
	if count <= extra:
		if count <= k:
			return 1
		return 0
	return 0
	print(l)


def kPangram(string, k):
	st = set()
	n = 0
	for i in string:
		if i.isalpha():
			n += 1
			st.add(i)
	if n < 26:
		return False
	if 26 - len(st) > k:
		return False
	return True


def kPangram(string, k):
	String = 'abcdefghijklmnopqrstuvwxyz'
	count = 0
	Count = 0
	for i in String:
		if i not in string:
			count += 1
	for i in string:
		if i in String:
			Count += 1
	if count <= k and Count >= 26:
		return 1
	else:
		return 0


def kPangram(string, k):
	string = string.replace(' ', '')
	str1 = string
	c = set(string)
	if len(c) == 26:
		return True
	if 26 - len(c) <= k and len(str1) >= 26:
		return True
	return False


def kPangram(string, k):
	D = {}
	for i in range(len(string)):
		if string[i].isalpha():
			if string[i] not in D:
				D[string[i]] = 1
			else:
				D[string[i]] += 1
	x = string.replace(' ', '')
	if len(x) >= 26 and 26 - len(D) <= k:
		return 1
	return 0


def kPangram(string, k):
	dic = {'q': 0, 'w': 0, 'e': 0, 'r': 0, 't': 0, 'y': 0, 'u': 0, 'i': 0, 'o': 0, 'p': 0, 'a': 0, 's': 0, 'd': 0, 'f': 0, 'g': 0, 'h': 0, 'j': 0, 'k': 0, 'l': 0, 'z': 0, 'x': 0, 'c': 0, 'v': 0, 'b': 0, 'n': 0, 'm': 0}
	for i in string:
		try:
			dic[i] += 1
		except:
			pass
	un = 0
	them = 0
	for i in dic:
		if dic[i] == 0:
			un += 1
		elif dic[i] > 1:
			them += dic[i] - 1
	if them >= un and k >= un:
		return True
	return False


def kPangram(string, k):
	count = 26
	anothercount = 0
	dic = 26 * [0]
	string1 = string.lower()
	for i in range(len(string1)):
		if string1[i] != ' ':
			if dic[ord(string1[i]) - ord('a')] == 0:
				count -= 1
			dic[ord(string1[i]) - ord('a')] += 1
			anothercount += 1
	if count <= k and anothercount >= 26:
		return True
	return False


def kPangram(str1, k):
	s = set()
	c = 0
	for i in str1:
		if i >= 'a' and i <= 'z':
			s.add(i)
			c += 1
	if c >= 26 and k >= 26 - len(s):
		return 1
	else:
		return 0


def kPangram(string, k):
	string = string.replace(' ', '')
	if len(string) < 26:
		return 0
	d = dict().fromkeys(string, 1)
	distinct_sum = sum(list(d.values()))
	need_changes = 26 - distinct_sum
	if need_changes <= k:
		return 1
	return 0


def kPangram(string, k):
	alp = [0] * 26
	length = 0
	for i in string:
		if i != ' ':
			length += 1
	if length < 26:
		return 0
	extra = 0
	for i in string:
		if i != ' ':
			alp[ord(i) - 97] = 1
	count = 0
	for i in range(26):
		if alp[i] == 0:
			count += 1
	if count == 0:
		return 1
	elif count <= k:
		return 1
	return 0


def kPangram(string, k):
	ans = []
	j = 0
	for i in range(97, 123):
		ans.append(chr(i))
	for i in string:
		if i == ' ':
			continue
		else:
			j = j + 1
			if i in ans:
				ans.remove(i)
	if j < 26:
		return 0
	if k >= len(ans):
		return 1
	else:
		return 0


def kPangram(s, k):
	t = list(s)
	x = t.copy()
	c = 0
	t = list(filter(' '.__ne__, t))
	if len(t) < 26:
		return False
	a = [chr(i) for i in range(97, 123)]
	for i in range(len(t)):
		if t[i] in a:
			a.remove(t[i])
			x.remove(t[i])
	if len(a) <= k:
		return True
	else:
		return False


def kPangram(string, k):
	h = [0] * 26
	repeated = required = 0
	for i in string:
		if i != ' ':
			index = ord(i.upper()) - 65
			if h[index] == 1:
				repeated += 1
			h[index] = 1
	for i in h:
		if i == 0:
			required += 1
	if repeated < required or required > k:
		return 0
	return 1


def kPangram(string, k):
	string.lower()
	l = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
	c = 0
	for i in string:
		if i != ' ':
			l[ord(i) % 97] += 1
			c += 1
	if c < 26:
		return False
	elif l.count(0) <= k:
		return True
	else:
		return False


from collections import defaultdict
from string import ascii_lowercase

def kPangram(string, k):
	d = defaultdict(int)
	string = ''.join((s for s in string.lower() if s.isalpha()))
	if len(string) < 26:
		return 0
	for letter in string.lower():
		if letter.isalpha():
			d[letter] += 1
	if len(ascii_lowercase) - len(d) <= k:
		return 1
	return 0


def kPangram(string, k):
	arr = ''
	string = string.replace(' ', '')
	for i in range(len(string)):
		if string[i] not in arr:
			arr += string[i]
	if len(arr) == 26:
		return 1
	elif len(string) >= 26 and len(arr) + k >= 26:
		return 1
	else:
		return 0


def kPangram(string, k):
	alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	s = set()
	count = 0
	for i in string:
		if i != ' ':
			s.add(i)
			count += 1
	if count >= 26 and 26 - len(s) <= k:
		return True
	else:
		return False


def kPangram(string, k):
	string = string.replace(' ', '')
	if len(string) < 26:
		return False
	req_alpha = 26 - len(set(string))
	return req_alpha <= k


def kPangram(string, k):
	operation_count = k
	temp_str = ''.join(string.split())
	sorted_Input = ''.join(sorted(temp_str))
	new_word = ''
	for i in sorted_Input:
		if i not in new_word:
			new_word = new_word + i
		else:
			pass
	new_word_len = len(new_word)
	output_return = new_word_len + operation_count
	if len(sorted_Input) < 26:
		k = 0
	elif output_return >= 26:
		k = 1
	else:
		k = 0
	return k