Your are given a string $S$ containing only lowercase letter and a array of character $arr$. Find whether the given string only contains characters from the given character array. 
Print $1$ if the string contains characters from the given array only else print $0$.
Note: string contains characters in lower case only.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains- 
a string $S$ of lowercase letter
a integer $n$ denoting length of character array $arr$
next line contains $n$ space separated characters.

-----Output:-----
For each testcase, Print $1$ if the string contains characters from the given array only else print $0$.

-----Constraints-----
- $1 \leq T \leq 1000$
- $0 \leq n \leq 10^5$

-----Sample Input:-----
3
abcd
4
a b c d
aabbbcccdddd
4
a b c d
acd
3
a b d

-----Sample Output:-----
1
1
0

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
t = int(input())
for _ in range(t):
	S = set(input().strip())
	n = int(input().strip())
	a = set(input().strip().split(' '))
	g = True
	for i in S:
		if i not in a:
			g = False
	if g:
		print(1)
	else:
		print(0)


for _ in range(int(input())):
	string = input().strip()
	n = int(input())
	lst = input().split()
	status = True
	for x in string:
		if x not in lst:
			status = False
			break
	if status:
		print(1)
	else:
		print(0)


T = int(input())
for i in range(T):
	S = input()
	n = int(input())
	arr = [str(j) for j in input().split()][:n]
	if len(set(S) - set(arr)) == 1:
		print(1)
	else:
		print(0)


from collections import Counter
for _ in range(int(input())):
	strs = set(input().strip())
	lens = int(input())
	inps = [x for x in input().split()]
	isOK = True
	for i in strs:
		if i not in inps:
			isOK = False
			break
	print(1 if isOK else 0)


t = int(input())
i = 0
while i < t:
	c = 0
	d = list(input().strip())
	s = set(d)
	n = int(input())
	k = input()
	lst = list(k.split())
	for j in s:
		if j in lst:
			continue
		else:
			c += 1
			break
	if c == 0:
		print('1')
	else:
		print('0')
	i += 1


for _ in range(int(input())):
	s = input().strip()
	n = int(input())
	l = list(input())
	f = 0
	for i in range(len(s)):
		if s[i] not in l:
			f = 1
			break
	if f == 1:
		print(0)
	else:
		print(1)


t = int(input())
for _ in range(t):
	st = input().strip()
	n = int(input())
	f = 1
	arr = input().split()
	for i in arr:
		st = st.replace(i, '')
	if len(st) == 0:
		print('1')
	else:
		print('0')


t = int(input())
for _ in range(t):
	s = input().strip()
	n = int(input())
	chars = set(input().split())
	flag = 1
	for i in s:
		if i not in chars:
			print(0)
			flag = 0
			break
	if flag:
		print(1)


t = int(input())
for _ in range(t):
	s = set(str(input()).strip())
	n = int(input())
	arr = set(str(input()).split())
	if len(s.difference(arr)) == 0:
		print(1)
	else:
		print(0)


for _ in range(int(input())):
	s = input().strip()
	n = int(input().strip())
	a = list(input().strip().split())
	a = list(set(a))
	flag = 0
	for i in s:
		if i not in a:
			flag = 1
			break
	if flag == 1:
		print('0')
	else:
		print('1')


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return list(map(int, inp().split()))

def smp():
	return list(map(str, inp().split()))

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True

def solve(md, s):
	for i in s:
		if i not in md:
			return 0
	return 1
for _ in range(int(inp())):
	s = inp()
	n = int(inp())
	arr = inp().split()
	md = {}
	for i in arr:
		if i not in md:
			md[i] = 1
	print(solve(md, s))


from itertools import groupby
for case in range(int(input())):
	string = ''.join(input().split())
	N = int(input())
	char_string = input()
	dicti = {i: len(list(i)) for (i, j) in groupby(string, key=None)}
	old = 0
	for i in dicti:
		if i not in char_string:
			old += 1
	if old == 0:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	s = input().strip()
	n = int(input().strip())
	li = input().strip().split()
	ans = 1
	for el in set(s):
		if el not in li:
			ans = 0
			break
	print(ans)


for _ in range(int(input())):
	s = input().strip()
	input()
	a = set(input().split())
	d = set(s)
	print(int(all((i in a for i in d))))