Check if the given string S is a Panagram or not. A pangram is a sentence containing every letter in the English Alphabet.
Example 1:
Input: S = "Pack mY box witH fIve dozen 
            liquor jugs"
Output: 1
Explanation: Given string contains all 
English Alphabets. 
Example 2:
Input: S = "geeksFORgeeks"
Output: 0
Explanation: Given string does not contain 
all English Alphabets. 
Your Task:  
You don't need to read input or print anything. Your task is to complete the function isPanagram() which takes the string as inputs and returns 1 if the given string is panagram, otherwise 0.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(constant)
Constraints:
1 ≤ |S| ≤ 10^{5}

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

Starter code: #User function Template for python3
class Solution:
	def isPanagram(self, S):
		# code here

Solutions:
class Solution:

	def isPanagram(self, s):
		list1 = []
		list1[:0] = s.lower()
		alphabet = [chr(value) for value in range(ord('a'), ord('a') + 26)]
		for i in range(0, 26):
			if alphabet[i] in list1:
				continue
			else:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		alphabet = 'abcdefghijklmnopqrstuvwxyz'
		for char in alphabet:
			if char not in S.lower():
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		a = S.lower()
		b = ''.join((i for i in a if i.isalnum()))
		c = list(set(b))
		if len(c) == 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		s = set()
		for i in S:
			if i.isalpha():
				s.add(i.lower())
		if len(s) == 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		list1 = [chr(i + 64) for i in range(1, 27)]
		if len(S) < 26:
			return 0
		for i in list1:
			if i.lower() in S or i in S:
				continue
			else:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		k = S.lower()
		l = []
		a = 'abcdefghijklmnopqrstuvwxyz'
		for i in a:
			if i in k:
				l.append(i)
		if ''.join(sorted(l)) == a:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		l = ['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 = S.lower()
		k = list(S)
		c = 0
		for i in range(26):
			if l[i] in k:
				c += 1
		if c == 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		if len(S) < 26:
			return 0
		seen = set()
		for i in S:
			if i not in seen and i.isalpha():
				if i.isupper() and chr(ord(i) + 32) not in seen or (i.islower() and chr(ord(i) - 32) not in seen):
					seen.add(i)
		if len(seen) >= 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		a = 'abcdefghijklmnopqrstvuwxyz'
		for char in a:
			if char not in S.lower():
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		a = S.lower()
		x = 'qwertyuiopasdfghjklmnbvcxz'
		c = 0
		for i in x:
			if i in a:
				c += 1
		if c == 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		k = 'abcdefghijklmnopqrstuvwxyz'
		d = dict()
		for ele in k:
			d[ele] = 0
		for ele in k:
			d[ele] = d[ele] + 1
		string = S.lower()
		for ele in string:
			if ele in d:
				d[ele] = d[ele] - 1
		for ele in d.keys():
			if d[ele] == 1:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		ss = S.replace(' ', '')
		s1 = ss.upper()
		li = [0] * 26
		for i in range(len(s1)):
			if ord(s1[i]) in range(65, 92):
				li[ord(s1[i]) - ord('A')] = 1
		for i in range(len(li)):
			if li[i] == 0:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		return int(not set('abcdefghijklmnopqrstuvwxyz') - set(S.lower()))


class Solution:

	def isPanagram(self, S):
		S = ''.join((x for x in S if x.isalnum()))
		for i in range(97, 123):
			if chr(i) in S or chr(i).upper() in S:
				continue
			else:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		s = S.lower()
		for i in 'abcdefghijklmnopqrstuvwxyz':
			if i not in s:
				return 0
				break
		return 1


class Solution:

	def isPanagram(self, S):
		if len(S) < 26:
			return 0
		S = S.lower()
		for ch in 'abcdefghijklmnopqrstuvwxyz':
			if ch not in S:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		alpha = 'abcdefghijklmnopqrstuvwxyz'
		alpha_list = list(alpha)
		for i in S.lower():
			if i in alpha_list:
				alpha_list.remove(i)
		if len(alpha_list) == 0:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		a = 'abcdefghijklmnopqrstuvwxyz'
		s1 = S.lower()
		s2 = set(s1)
		s3 = ''.join(s2)
		s4 = ''
		for i in s3:
			if i.isalpha():
				s4 = s4 + i
		s5 = sorted(s4)
		s6 = ''.join(s5)
		if s6 == a:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		t = ''
		for i in S.lower():
			if i >= 'a' and i <= 'z' or (i >= 'A' and i <= 'Z'):
				if i not in t:
					t += i
		if len(t) == 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, s):
		s = s.lower()
		setting = set()
		for elm in s:
			if elm.isalpha():
				setting.add(elm)
		if len(setting) < 26:
			return 0
		return 1


class Solution:

	def isPanagram(self, s):
		if len(s) < 26:
			return 0
		d = set()
		s = s.lower()
		for i in s:
			d.add(i)
		if len(d) >= 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		st = set()
		for i in S:
			if i.isalpha():
				st.add(i.upper())
		if len(st) == 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		s = S.lower()
		l = []
		for i in s:
			if ord(i) >= 97 and ord(i) <= 122:
				l.append(i)
		se = set(l)
		if len(se) == 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		bad_chars = [';', ':', '!', '*', ' ', '%', '#', '$', '@', '&']
		for i in bad_chars:
			S = S.replace(i, '')
		x = set(S.lower())
		if len(x) == 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		arr = [0] * 26
		for i in range(len(S)):
			if S[i].isalpha():
				temp = S[i].lower()
				index = ord(temp) - 97
				arr[index] = 1
		for i in range(26):
			if arr[i] == 0:
				return 0
				break
		else:
			return 1


class Solution:

	def isPanagram(self, S):
		S = S.lower()
		d = dict()
		for i in range(26):
			if i not in d:
				d[i] = 0
		for i in S:
			if i == ' ':
				continue
			d[ord(i) - 97] = 1
		for i in range(26):
			if d[i] == 0:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		S = S.lower()
		l = []
		for i in range(0, 26):
			l.append(0)
		for i in range(0, len(S)):
			if ord(S[i]) >= 97 and ord(S[i]) <= 122:
				c = ord(S[i]) - 97
				l[c] = l[c] + 1
		for i in range(0, len(l)):
			if l[i] == 0:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		count = [0] * 26
		for i in S:
			if i >= 'a' and i <= 'z':
				pos = ord(i) - ord('a')
				count[pos] = 1
			elif i >= 'A' and i <= 'Z':
				pos = ord(i) - ord('A')
				count[pos] = 1
		for i in range(26):
			if count[i] == 0:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		s = 'qwertyuiopasdfghjklzxcvbnm'
		for i in s:
			if i not in S.lower():
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		arr = [''] * 26
		for i in range(len(S)):
			if ord(S[i]) in range(65, 91):
				arr[ord(S[i]) - 65] = S[i]
			if ord(S[i]) in range(97, 123):
				arr[ord(S[i]) - 97] = S[i]
			else:
				continue
		if '' in arr:
			return 0
		return 1


class Solution:

	def isPanagram(self, S):
		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 = ''.join(sorted(S)).lower().strip()
		ans = set(alpha).difference(set(s))
		if len(ans) == 0:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		l = []
		for c in S:
			for k in c:
				if k.lower() >= 'a' and k.lower() <= 'z':
					if k.lower() not in l:
						l.append(k.lower())
		if len(l) == 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		string = ''
		S = S.lower()
		for i in S:
			if i.isalpha():
				string += i
		d = {}
		for i in string:
			if i not in d:
				d[i] = 1
			else:
				d[i] += 1
		if len(d) == 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		X = ''
		S = S.lower()
		for i in S:
			if i.isalpha():
				X += i
		h = {}
		for i in X:
			if i not in h:
				h[i] = 1
			else:
				h[i] += 1
		if len(h) == 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		st = 'abcdefghijklmnopqrstuvwxyz'
		S = S.lower()
		for i in st:
			if i not in S:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		if len(S) < 26:
			return 0
		else:
			lowerS = S.lower()
			arr = []
			for i in range(26):
				arr.append(False)
			for i in range(0, len(lowerS)):
				carCodeValue = ord(lowerS[i])
				if int(carCodeValue) > 96 and int(carCodeValue) < 123:
					arr[carCodeValue - 97] = True
			for i in arr:
				if i == False:
					return 0
			return 1


class Solution:

	def isPanagram(self, S):
		k = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		M = 'abcdefghijklmnopqrstuvwxyz'
		for i in range(26):
			if k[i] not in S and M[i] not in S:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		S = S.lower()
		m = {}
		for i in range(97, 123):
			m[chr(i)] = 0
		for i in S:
			if i != ' ':
				m[i] = 1
		for i in m:
			if m[i] == 0:
				return 0
		return 1
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		S = input()
		ob = Solution()
		answer = ob.isPanagram(S)
		print(answer)


class Solution:

	def isPanagram(self, S):
		n = 0
		a = 'abcdefghijkl mnopqrstuvwxyz'
		s = S.lower()
		for i in range(0, len(a)):
			if a[i] in s:
				n = 1
			else:
				return 0
		return n
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		S = input()
		ob = Solution()
		answer = ob.isPanagram(S)
		print(answer)


class Solution:

	def isPanagram(self, S):
		S = S.lower()
		S = S.split()
		S = ''.join(S)
		d = {}
		for c in S:
			if c not in 'abcdefghijklmnopqrstuvwxyz':
				continue
			else:
				d[c] = 1
		return 1 if len(d) == 26 else 0
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		S = input()
		ob = Solution()
		answer = ob.isPanagram(S)
		print(answer)


class Solution:

	def isPanagram(self, S):
		l = ['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 = S.lower()
		k = list(S)
		c = 0
		for i in range(26):
			if l[i] in k:
				c += 1
			if c == 26:
				return 1
		return 0
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		S = input()
		ob = Solution()
		answer = ob.isPanagram(S)
		print(answer)


class Solution:

	def isPanagram(self, S):
		s = S.lower()
		t = [0] * 26
		for i in s:
			if ord(i) - ord('a') >= 0 and ord(i) - ord('a') <= 25:
				t[ord(i) - ord('a')] = 1
		for i in t:
			if i == 0:
				return 0
		return 1
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		S = input()
		ob = Solution()
		answer = ob.isPanagram(S)
		print(answer)


class Solution:

	def isPanagram(self, S):
		arr = [0 for i in range(26)]
		for i in range(len(S)):
			if S[i] >= 'a' and S[i] <= 'z' or (S[i] >= 'A' and S[i] <= 'Z'):
				temp = S[i].lower()
				index = ord(temp) - 97
				arr[index] = 1
		for i in range(26):
			if arr[i] == 0:
				return 0
				break
		return 1
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		S = input()
		ob = Solution()
		answer = ob.isPanagram(S)
		print(answer)


class Solution:

	def isPanagram(self, s):
		s = s.lower()
		t = ''
		for i in s:
			if i.isalpha():
				t += i
		return 1 if len(set(t)) == 26 else 0


class Solution:

	def isPanagram(self, S):
		S = S.lower()
		all_alpha = []
		for i in range(97, 123):
			all_alpha.append(i)
		for w in S:
			if ord(w) in all_alpha:
				all_alpha.remove(ord(w))
		if len(all_alpha) == 0:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		s = S.lower()
		set1 = set([])
		al = {'j', 'd', 'y', 's', 'f', 'x', 'e', 'n', 'g', 'a', 'l', 'i', 'z', 't', 'b', 'o', 'k', 'q', 'p', 'c', 'h', 'm', 'v', 'w', 'u', 'r'}
		for i in s:
			if i in al:
				set1.add(i)
			else:
				pass
		if len(set1) == 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		S = S.lower()
		se = set(S)
		s1 = ''
		for i in se:
			if i.isalpha():
				s1 += i
		if len(s1) == 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, s):
		s = s.lower()
		if len(s) < 26:
			return 0
		else:
			s1 = set()
			for ch in s:
				if ch.isalpha():
					s1.add(ch)
			if len(s1) == 26:
				return 1
			else:
				return 0


class Solution:

	def isPanagram(self, S):
		count = 0
		alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'w', 'x', 'y', 'z']
		arr = [0] * 26
		S = S.lower()
		for i in S:
			pos = ord(i) - 97
			if pos >= 0 and pos < 26:
				arr[pos] = 1
		for i in arr:
			if i == 0:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		S = S.upper()
		S = ''.join((i for i in S if i.isalpha()))
		l = []
		for i in S:
			if i not in l:
				l.append(i)
		if len(l) == 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		S = S.upper()
		arr = [0] * 26
		for i in S:
			pos = ord(i) - 65
			if pos >= 0 and pos < 26:
				arr[pos] = arr[pos] + 1
		for i in arr:
			if i == 0:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		S = S.lower()
		arr = [0] * 26
		for i in S:
			pos = ord(i) - 97
			if pos >= 0 and pos < 26:
				arr[pos] = arr[pos] + 1
		for i in arr:
			if i == 0:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		s = S.upper()
		l = [0] * 256
		for x in range(len(s)):
			l[ord(s[x])] += 1
		for i in range(65, 91):
			if l[i] < 1:
				return 0
		return 1


from collections import Counter

class Solution:

	def isPanagram(self, S):
		l = ''
		S = S.lower()
		for i in S:
			if i.isalpha():
				l += i
		k = Counter(l)
		if len(k) == 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		d = [0 for j in range(26)]
		for ch in S:
			if not ch.isalpha():
				continue
			d[ord(ch.lower()) - 97] += 1
		for i in range(26):
			if d[i] == 0:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		S = S.lower()
		s = 'abcdefghijklmnopqrstuvwxyz'
		for i in s:
			if i in S:
				pass
			else:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		S = S.lower()
		S = list(S)
		x = 'abcdefghijklmnopqrstuvwxyz'
		x = list(x)
		c = 0
		for i in range(26):
			if x[i] in S:
				c += 1
		if c == 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		S = S.lower()
		arr = []
		for i in S:
			if i.isalpha():
				arr.append(i)
		arr = set(arr)
		arr = sorted(arr)
		x = 'abcdefghijklmnopqrstuvwxyz'
		x = list(x)
		if arr == x:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		x = ''
		for i in S:
			if i.isalpha():
				x += i.lower()
		if len(set(list(x))) == 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, s):
		s = s.lower()
		c = 0
		l = list(s)
		res = [0] * 26
		for i in range(len(l)):
			if ord(l[i]) >= 97 and ord(l[i]) <= 122:
				res[ord(l[i]) - 97] = 1
		for i in range(len(res)):
			if res[i] == 0:
				c = -1
				return 0
				break
		if c == 0:
			return 1


class Solution:

	def isPanagram(self, S):
		for i in range(0, 26):
			if chr(ord('a') + i) not in S.lower():
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		sum = 0
		l = list(S)
		csmall = 0
		xs = []
		for i in l:
			if i.isupper():
				i = i.lower()
			if ord(i) >= 97 and ord(i) <= 122:
				if i in xs:
					pass
				else:
					xs.append(i)
					csmall = csmall + 1
		if len(xs) == 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		s1 = S.lower()
		ss = set()
		for x in s1:
			if ord(x) >= 96 and ord(x) <= 122:
				ss.add(x)
		if len(ss) == 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		d = {}
		cnt = 0
		for i in S:
			if i.isalpha():
				d[i.lower()] = 0
		for i in S:
			if i.isalpha():
				d[i.lower()] += 1
		for i in d.keys():
			cnt += 1
		if cnt == 26:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		alpha = 'abcdefghijklmnopqrstuvwxyz'
		x = 1
		for i in alpha:
			if i in S.lower():
				x = 1
			else:
				x = 0
				break
		return x


import string
lCase = string.ascii_lowercase

class Solution:

	def isPanagram(self, s):
		s = s.lower()
		for i in lCase:
			if i not in s:
				return 0
		return 1


class Solution:

	def isPanagram(self, S):
		k = S.lower()
		l = []
		for i in k:
			if i not in l and i.isalpha():
				l.append(i)
		if len(l) == 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		l = []
		s = 0
		for i in S:
			if i.lower() not in l and i.isalpha():
				s = s + ord(i.lower())
				l.append(i.lower())
		if s == 2847:
			return 1
		else:
			return 0


class Solution:

	def isPanagram(self, S):
		s = set()
		ss = S.lower()
		for x in ss:
			s.add(x)
		if len(s) >= 26:
			return 1
		return 0


class Solution:

	def isPanagram(self, S):
		s = S.upper()
		i = 1
		t = 0
		while i != 27:
			if chr(64 + i) in s:
				t = 0
				i += 1
				continue
			else:
				t = 1
				return 0
		if t == 0:
			return 1


import re

class Solution:

	def isPanagram(self, S):
		alpha = [0] * 26
		S = S.lower()
		S = re.sub('\\W', '', S)
		for char in S:
			alpha[ord(char) - ord('a')] += 1
		for i in alpha:
			if i == 0:
				return 0
		return 1