AtCoder Beginner Contest 084 - Postal Code

The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.

-----Constraints-----
 - 1≤A,B≤5
 - |S|=A+B+1
 - S consists of - and digits from 0 through 9.

-----Input-----
Input is given from Standard Input in the following format:
A B
S

-----Output-----
Print Yes if S follows the postal code format in AtCoder Kingdom; print No otherwise.

-----Sample Input-----
3 4
269-6650

-----Sample Output-----
Yes

The (A+1)-th character of S is -, and the other characters are digits from 0 through 9, so it follows the format.

Difficulty: EASY

Starter code:

Solutions:
(A, B) = map(int, input().split())
S = input()
print('Yes' if S[:A].isdigit() and S[A] == '-' and S[A + 1:].isdigit() else 'No')


(a, b) = map(int, input().split())
s = input().split('-')
print('Yes' if len(s[0]) == a and len(s[1]) == b else 'No')


import re
(A, B) = list(map(int, input().split()))
S = input()
ans = 'No'
p = '\\d{' + str(A) + '}-\\d{' + str(B) + '}'
if re.match(p, S):
	ans = 'Yes'
print(ans)


(a, b) = map(int, input().split())
s = input()
num = '0123456789'
if all((s[i] in num for i in range(a))) and s[a] == '-' and all((s[-(i + 1)] in num for i in range(b))):
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
s = input()
t = s.split('-')
print('Yes' if s[a] == '-' and len(t) == 2 else 'No')


import re
(A, B) = map(int, input().split())
print(['Yes', 'No'][re.match('\\d{{{}}}-\\d{{{}}}\\Z'.format(A, B), input()) is None])


(A, B) = map(int, input().split())
S = list(map(lambda x: len(x), input().split('-')))
print('Yes' if A == S[0] and B == S[1] else 'No')


import re
(a, b) = map(int, input().split())
print('Yes' if re.match('\\d{{{}}}-\\d{{{}}}'.format(a, b), input()) else 'No')


a = int(input()[0])
s = input()
print('YNeos'[s.count('-') != 1 or s[a] > '-'::2])


(a, b) = map(int, input().split())
s = list(input())
ans = 'No'
if s.count('-') == 1:
	ind = s.index('-')
	alen = ind
	blen = len(s) - (ind + 1)
	if alen == a and blen == b:
		ans = 'Yes'
print(ans)


(A, B) = map(int, input().split())
S = input()
if S[A] == '-' and S.count('-') < 2:
	print('Yes')
else:
	print('No')


(A, B) = map(int, input().split())
S = input()
D = [str(i) for i in range(10)]
T = S[:A] + S[A + 1:]
if S[A] == '-' and all((t in D for t in T)):
	print('Yes')
else:
	print('No')


(A, B) = map(int, input().split())
D = list(input())
if D[A] == '-' and D.count('-') == 1:
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
s = input()
c = 0

def is_int(s):
	try:
		int(s)
		return True
	except ValueError:
		return False
for i in range(a):
	if is_int(s[i]) == True:
		c += 1
for i in range(a + 1, a + b):
	if is_int(s[i]) == True:
		c += 1
if s[a] == '-' and c == len(s) - 2:
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
s = input()
print('Yes' if s.count('-') == 1 and s[a] == '-' else 'No')


(a, b) = map(int, input().split())
s = input()
print('Yes' if s[a] == '-' and str.isdigit(s[:a]) and str.isdigit(s[b + 1:]) else 'No')


(A, B) = list(map(int, input().split()))
L = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
s = str(input())
for i in range(len(s)):
	if i == A:
		if s[A] != '-':
			print('No')
			return
	else:
		b = s[i]
		if b not in L:
			print('No')
			return
print('Yes')


import sys
import copy
import math
import itertools
import numpy as np
l = [int(c) for c in input().split()]
A = l[0]
B = l[1]
S = input()
if S[A] == '-' and str.isdecimal(S[0:A] + S[A + 1:A + B]):
	print('Yes')
else:
	print('No')


import re

def answer(a: int, b: int, s: str) -> str:
	pattern = f'\\d{{{a}}}-\\d{{{b}}}'
	if re.match(pattern, s):
		return 'Yes'
	return 'No'

def main():
	(a, b) = list(map(int, input().split()))
	s = input()
	print(answer(a, b, s))

def __starting_point():
	main()
__starting_point()


import re
(a, b) = map(int, input().split())
s = input()
s = re.sub('[0-9]', '+', s)
if s[0:a].count('+') == a and s[a] == '-' and (s[a + 1:a + b + 1].count('+') == b):
	print('Yes')
else:
	print('No')


(A, B) = map(int, input().split())
s = input()
S = s.split('-')
if len(S[0]) == A and len(S[1]) == B:
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
s = input()
res = s.split('-')
if len(res) == 2:
	if len(res[0]) == a and len(res[1]) == b and res[0].isdigit() and res[1].isdigit():
		print('Yes')
	else:
		print('No')
else:
	print('No')


(A, B) = map(int, input().split())
s = input()
print('Yes' if s.count('-') == 1 and s.index('-') == A else 'No')


(a, b) = map(int, input().split())
s = list(input())

def f():
	for i in range(len(s)):
		if i == a:
			if s[i] != '-':
				return 'No'
		elif s[i] == '-':
			return 'No'
	return 'Yes'
print(f())


import re
(A, B) = list(map(int, input().split()))
S = input()
n_pattern = '[0-9]'
res = 'Yes'
for i in range(A + B + 1):
	if i < A:
		if re.match(n_pattern, S[i]) is None:
			res = 'No'
			break
	elif i == A:
		if S[i] != '-':
			res = 'No'
			break
	elif re.match(n_pattern, S[i]) is None:
		res = 'No'
		break
print(res)


(a, _, s) = open(0).read().split()
print('YNeos'[s.count('-') > 1 or '-' != s[int(a)]::2])


(a, b) = map(int, input().split())
s = input()
print('Yes' if s[a] == '-' and s.replace('-', '0', 1).isdecimal() else 'No')


import re
(a, b) = map(str, input().split())
s = input()
print('Yes' if re.match('\\d{' + a + '}-\\d{' + b + '}', s) else 'No')


(A, B) = map(int, input().split())
S = input()
result = 'Yes'
if '-' in S[:A]:
	result = 'No'
if '-' not in S[A]:
	result = 'No'
if '-' in S[A + 1:]:
	result = 'No'
print(result)


(a, b) = map(int, input().split())
s = input().split('-')
print('YNeos'[len(s) != 2 or len(s[0]) != a::2])


import re
(n, m) = input().split()
print('YNeos'[re.match('[0-9]{' + n + '}-[0-9]{' + m + '}', input()) is None::2])


import re
import sys
(A, B) = map(int, input().split())
S = input()
if S[A] != '-':
	print('No')
	return
S = S.replace('-', '')
if len(S) == 0:
	print('No')
	return
count = 0
for i in range(len(S)):
	if re.match('[0-9]', S[i]):
		count += 1
if count == A + B:
	print('Yes')
else:
	print('No')


import re
(n, m) = input().split()
print('YNeos'[not re.match('[0-9]{' + n + '}-[0-9]{' + m + '}', input())::2])


(A, B) = map(int, input().split())
S = list(str(input()))
if S.count('-') == 1 and S[A] == '-':
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
s = input()
print('YNeos'[s.count('-') != 1 or s[a] != '-'::2])


(a, b) = list(map(int, input().split()))
s = input()
ans = True
for i in range(a + b + 1):
	if s[a] != '-':
		ans = False
		break
	elif i == a:
		pass
	else:
		for j in range(10):
			if s[i] == str(j):
				break
		else:
			ans = False
if ans:
	print('Yes')
else:
	print('No')


(A, B) = map(int, input().split())
S = input()
a = S[:A]
b = S[A]
c = S[A + 1:]
ans = True
for i in range(A):
	if a[i].isdigit() == False:
		print('No')
		return
if b != '-':
	print('No')
	return
for i in range(B):
	if c[i].isdigit() == False:
		print('No')
		return
print('Yes')


import re
n = input()
print('YNeos'[not re.match('[0-9]{' + n[0] + '}-[0-9]{' + n[-1] + '}', input())::2])


(A, B) = map(int, input().split())
a = input().split('-')
if len(a[0]) == A and len(a[1]) == B:
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
s = input()
print('Yes' if s[a] == '-' and (not '-' in s[:a] + s[-b:]) else 'No')


(A, B) = map(int, input().split())
S = list(input())
ans = 'No'
if S[A] == '-' and S.count('-') == 1:
	ans = 'Yes'
print(ans)


(A, B) = map(int, input().split())
S = input()
import re
print('Yes' if re.match('^[0-9]{%d}-[0-9]{%d}$' % (A, B), S) else 'No')


import re
(A, B) = input().split()
S = input()
my_regex = '\\d{' + A + '}-\\d{' + B + '}'
if re.fullmatch(my_regex, S) == None:
	print('No')
else:
	print('Yes')


import re
(a, b) = map(int, input().split())
s = input().split('-')
print('Yes' if len(s) == 2 and len(s[0]) == a else 'No')


(a, b) = list(map(int, input().split()))
s = input()
if len(s) != a + b + 1:
	print('No')
	return
elif s[a] != '-':
	print('No')
	return
elif s.count('-') != 1:
	print('No')
	return
print('Yes')


(a, b) = list(map(int, input().split()))
S = input()
d = 0
c = a + b + 3
for i in range(a + b + 1):
	if S[i] == '-':
		c = i + 1
		d += 1
if c == a + 1 and d == 1:
	print('Yes')
else:
	print('No')


(A, B) = map(int, input().split(' '))
S = str(input())
ans = 'Yes'
if S[A] != '-':
	ans = 'No'
else:
	S = S.replace('-', '', 1)
	if S.isdecimal() == False:
		ans = 'No'
print(ans)


(n, m) = map(int, input().split())
s = input()
print('Yes' if s[n] == '-' and s[:n].isdecimal() and s[n + 1:].isdecimal() else 'No')


(a, b) = map(int, input().split())
s = input()
print('NYoe s'[s[0:a].isdecimal() and s[a] == '-' and s[a + 1:].isdecimal()::2])


(a, b) = map(int, input().split())
s = input()
res = 'No'
if s[a] == '-':
	if s[:a].isdecimal() and s[a + 1:].isdecimal():
		res = 'Yes'
print(res)


import re
(a, b) = input().split()
r = re.match('\\d{' + a + '}-\\d{' + b + '}$', input())
print('Yes' if r else 'No')


(A, B) = map(int, input().split())
S = input()
print('Yes' if len(S) == A + B + 1 and S.count('-') == 1 and (S[A] == '-') else 'No')


(a, s) = open(0)
print('YNeos'[s.count('-') != 1 or '-' < s[int(a[0])]::2])


(A, B) = map(int, input().split())
d = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
S = input()
total = 0
for i in range(A):
	if S[i] in d:
		pass
	else:
		total = 1
S = S[A:]
if S[0] != '-':
	total = 1
S = S[1:]
for i in range(B):
	if S[i] in d:
		pass
	else:
		total = 1
if total == 1:
	print('No')
else:
	print('Yes')


(a, b) = list(map(int, input().split()))
s = input()
count = 0
ans = 'Yes'
for i in range(a + b + 1):
	if i == a:
		if s[i] != '-':
			ans = 'No'
			break
	elif s[i] == '-':
		ans = 'No'
		break
print(ans)


import re
(a, b) = [int(i) for i in input().split()]
print('Yes' if re.match('^\\d{%d}-\\d{%d}$' % (a, b), input()) else 'No')


(A, B) = list(map(int, input().split()))
S = input()
cnt = 0
for i in S:
	if i == '-':
		cnt += 1
if cnt == 1:
	post = S.split('-')
	if len(post[0]) == A and len(post[1]) == B:
		print('Yes')
		return
print('No')


(a, b) = map(int, input().split())
s = list(input())
if len(s) == a + b + 1:
	if s[a] == '-':
		del s[a]
		try:
			if all([0 <= int(x) <= 9 for x in s]):
				print('Yes')
			else:
				print('No')
		except:
			print('No')
	else:
		print('No')
else:
	print('No')


(a, b) = list(map(int, input().split()))
s = input()
ans = True
for (i, char) in enumerate(s):
	if i == a:
		if char == '-':
			ans = True
		else:
			ans = False
			break
	else:
		try:
			ans = type(int(char)) is int
		except:
			ans = False
			break
if ans:
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
s = input()
ans = 'Yes'
for i in range(len(s)):
	if i > a + b:
		ans = 'No'
		break
	if i == a:
		if s[i] != '-':
			ans = 'No'
			break
	elif not s[i].isdigit():
		ans = 'No'
		break
print(ans)


import re
(a, b) = list(map(int, input().split()))
s = input()
if re.search('[0-9][0-9]*', s[0:a]):
	if s[a] == '-':
		if re.search('[0-9][0-9]*', s[a + 1:]):
			print('Yes')
			return
print('No')


import re
(A, B) = map(int, input().split())
S = input()
pattern = re.compile('[0-9]' * A + '-' + '[0-9]' * B)
print('Yes' if pattern.fullmatch(S) != None else 'No')


(A, B) = map(int, input().split())
S = input()
if (S[:A] + S[-B:]).isdecimal() and S[A] == '-':
	print('Yes')
else:
	print('No')


(A, B) = map(int, input().split())
S = input()
if not '-' in S[:A] + S[A + 1:] and S[A] == '-':
	print('Yes')
else:
	print('No')


(a, b) = list(map(int, input().split()))
s = input()
for i in range(a + b + 1):
	if i == a:
		if s[i] != '-':
			print('No')
			break
	elif s[i] == '-':
		print('No')
		break
	elif int(s[i]) < 0 or 9 < int(s[i]):
		print('No')
		break
else:
	print('Yes')


(a, b) = map(int, input().split())
s = input()
for i in s[0:a]:
	if 48 <= ord(i) and ord(i) <= 57:
		continue
	else:
		print('No')
		return
if s[a] != '-':
	print('No')
	return
for i in s[a + 1:a + b + 1]:
	if 48 <= ord(i) and ord(i) <= 57:
		continue
	else:
		print('No')
		return
print('Yes')


def main():
	(A, B) = list(map(int, input().split()))
	S = input()
	cond = [len(S) == A + B + 1, S[A] == '-', S[:A].isdigit(), S[A + 1:].isdigit()]
	print('Yes' if all(cond) else 'No')

def __starting_point():
	main()
__starting_point()


import re
(A, B) = map(int, input().split())
print('Yes' if re.match('^\\d{%d}-\\d{%d}$' % (A, B), input()) else 'No')


(a, b) = map(int, input().split())
s = input()
x = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
if s[a] != '-':
	print('No')
	return
s = list(s)
del s[a]
for i in s:
	if i not in x:
		print('No')
		return
print('Yes')


import re
(a, b) = map(int, input().split())
print(re.fullmatch('[0-9]{%d}-[0-9]{%d}' % (a, b), input()) and 'Yes' or 'No')


print('YNeos'[tuple(map(int, input().split())) != tuple(map(len, input().split('-')))::2])


(A, B) = [int(x) for x in input().split()]
S = input()
if (S[:A] + S[-B:]).isdecimal() and S[A] == '-':
	print('Yes')
else:
	print('No')


(A, B) = map(int, input().split())
S = input()
flag = False
if S[A] == '-':
	S_ = S.split('-')
	if len(S_) == 2:
		if len(S_[0]) == A and len(S_[1]) == B:
			if S_[0].isdigit() and S_[1].isdigit():
				flag = True
if flag:
	print('Yes')
else:
	print('No')


(a, b) = input().split()
c = input()
a = int(a)
b = int(b)
d = 0
if c[a] == '-':
	for i in range(a + b + 1):
		if c[i] == '-':
			d = d + 1
	if d == 1:
		print('Yes')
	else:
		print('No')
else:
	print('No')


(l, m) = map(int, input().split())
p = input().split('-')
print('NYoe s'[len(p) == 2 and len(p[0]) == l and (len(p[1]) == m)::2])


a = list(map(int, input().split()))
S = input()
if S.count('-') == 1 and S[a[0]] == '-':
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
s = input()
print(['No', 'Yes'][s[a] == '-' and s.count('-') < 2])


(a, b) = map(int, input().split())
s = input()
print('Yes' if all([s[:a].isdigit(), s[a] == '-', s[a + 1:].isdigit()]) else 'No')


(a, b) = list(map(int, input().split()))
s = input()
if s[:a].isdecimal() and s[a] == '-' and s[a + 1:].isdecimal():
	print('Yes')
else:
	print('No')


a = int(input()[0])
s = input()
print('NYoe s'[s.count('-') == 1 and '0' > s[a]::2])


(a, b) = list(map(int, input().split()))
s = input()
if len(s) == a + b + 1:
	if s[a] == '-':
		cnt = 0
		for i in range(len(s)):
			if s[i] == '0' or s[i] == '1' or s[i] == '2' or (s[i] == '3') or (s[i] == '4') or (s[i] == '5') or (s[i] == '6') or (s[i] == '7') or (s[i] == '8') or (s[i] == '9'):
				cnt += 1
		if cnt == a + b:
			print('Yes')
		else:
			print('No')
	else:
		print('No')
else:
	print('No')


(a, b) = map(int, input().split())
s = input()
t = s[:a] + s[-b:]
flg = s[a] == '-' and t.isdecimal()
print(['No', 'Yes'][flg])


(n, m) = map(int, input().split())
s = input()
print('No' if s[n] != '-' or '-' in s[:n] + s[-m:] else 'Yes')


(a, b) = map(int, input().split())
s = str(input())
e = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
for i in range(len(s)):
	if a == i:
		if s[i] != '-':
			print('No')
			return
	elif s[i] not in e:
		print('No')
		return
print('Yes')


(a, b) = map(int, input().split())
n = input()
if n[0:a].isdecimal() and n[a] == '-' and n[a + 1:a + b + 1].isdecimal():
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
s = input()
t = s[:a] + s[a + 1:]
bl = s[a] == '-' and t.find('-') == -1
print('Yes' if bl else 'No')


(a, b) = list(map(int, input().split()))
s = input()
if len(s) != a + b + 1:
	print('No')
	return
elif s[a] != '-':
	print('No')
	return
else:
	for i in range(0, a):
		if s[i] == '-':
			print('No')
			return
	for i in range(a + 1, a + b + 1):
		if s[i] == '-':
			print('No')
			return
print('Yes')


(a, b) = map(int, input().split())
n = input()
if 1 <= a <= 5 and 1 <= b <= 5:
	if n[a] == '-':
		if n[0:a].isdecimal() and n[a + 1:a + b + 1].isdecimal():
			print('Yes')
			return
print('No')


def mapt(fn, *args):
	return tuple(map(fn, *args))

def Input():
	return mapt(int, input().split(' '))

def main():
	(a, b) = Input()
	s = input()
	if all((chr == '-' if index == a else chr.isdigit() for (index, chr) in enumerate(s))):
		print('Yes')
	else:
		print('No')
main()


(A, B) = map(int, input().split())
S = input()
print('NYoe s'[S[A] == '-' and S.count('-') == 1::2])


(a, b) = map(int, input().split())
s = input()
A = s[:a]
con = s[a]
B = s[-b:]
flg = True
num = [str(x) for x in range(10)]
num = set(num)
for x in A:
	if x not in num:
		flg = False
for x in B:
	if x not in num:
		flg = False
if con != '-':
	flg = False
print('Yes' if flg else 'No')


(a, b, s) = open(0).read().split()
a = int(a)
try:
	int(s[:a]) + int(s[a + 1:])
	print('YNeos'[s[a] != '-'::2])
except:
	print('No')


((A, B), S) = (map(int, input().split()), input())
print('No' if '-' in S[:A] + S[A + 1:] or S[A] != '-' else 'Yes')


(a, b) = map(int, input().split())
S = input()
for i in range(len(S)):
	if i == a:
		if S[i] != '-':
			print('No')
			break
	else:
		try:
			Si = int(S[i])
		except:
			print('No')
			break
else:
	print('Yes')


(A, B) = map(int, input().split())
S = input()
flag = False
for i in range(A):
	if S[i] == '-':
		flag = True
if S[A] != '-':
	flag = True
for i in range(A + 1, A + B + 1):
	if S[i] == '-':
		flag = True
if flag:
	print('No')
else:
	print('Yes')


a = int(input()[0])
s = input()
print('NYoe s'[a == s.find('-') == s.rfind('-')::2])


(a, b) = map(int, input().split())
s = input()
try:
	int(s[:a]) + int(s[a + 1:])
	print(['No', 'Yes'][s[a] == '-'])
except:
	print('No')


import re
(a, b) = input().split()
s = input()
m = re.fullmatch('\\d{' + a + '}-\\d{' + b + '}', s)
print('No' if m is None else 'Yes')


(a, b) = (int(i) for i in input().split())
s = input()
if '-' not in s[:a] and s[a] == '-' and ('-' not in s[a + 1:]):
	print('Yes')
else:
	print('No')


(A, B) = map(int, input().split())
S = list(input().split('-'))
check = False
if len(S) == 2:
	(s, t) = (S[0], S[1])
	if A == len(s) and B == len(t):
		check = True
print('Yes' if check else 'No')


import sys
sys.setrecursionlimit(10 ** 6)
(a, b) = list(map(int, input().split()))
s = str(input())
x = s.split('-')
if len(x[0]) == a and len(x[1]) == b:
	print('Yes')
else:
	print('No')


(a, b, s) = open(0).read().split()
a = int(a)
print('NYoe s'[s.count('-') == 1 and '0' > s[a]::2])


import re
(A, B) = map(int, input().split())
S = input()
former = S[0:A]
later = S[A + 1:A + B + 3]
r_f = re.compile('\\d{' + str(A) + '}')
r_l = re.compile('\\d{' + str(B) + '}')
if r_f.findall(former) and r_l.findall(later) and (S[A] == '-'):
	print('Yes')
else:
	print('No')


dg = '0123456789'
(A, B) = map(int, input().split())
S = input()
postcode = True
for (i, ch) in enumerate(S):
	if i == A:
		if ch != '-':
			postcode = False
			break
	elif ch not in dg:
		postcode = False
		break
if postcode:
	print('Yes')
else:
	print('No')


import sys

def LI():
	return list(map(int, input().split()))
(A, B) = LI()
S = input()
ans = 'Yes'
for i in range(A):
	if S[i] == '-':
		ans = 'No'
		break
if S[A] != '-':
	ans = 'No'
for i in range(A + 1, A + B + 1):
	if S[i] == '-':
		ans = 'No'
		break
print(ans)


import re
(a, b) = list(map(int, input().split()))
s = input()
if s[a] == '-':
	if '-' not in s[:a] + s[a + 1:]:
		print('Yes')
		return
print('No')


(a, b) = map(int, input().split())
s = input()
for i in range(a + b + 1):
	if i == a:
		if s[i] != '-':
			print('No')
			return
	elif s[i] == '-':
		print('No')
		return
print('Yes')


(A, B) = list(map(int, input().split()))
S = input()
if len(S) != A + B + 1:
	print('No')
	return
for i in range(A + B + 1):
	if i == A:
		if S[i] != '-':
			print('No')
			return
	elif not '0' <= S[i] <= '9':
		print('No')
		return
print('Yes')


(x, y) = map(int, input().split())
S = input()
if len(S) == x + y + 1 and S[x] == '-' and (S.count('-') == 1):
	print('Yes')
else:
	print('No')


a = int(input()[0])
s = input()
print('YNeos'[s[a] > '-' or '-' in s[:a] + s[a + 1:]::2])


(A, B) = map(int, input().split())
S = input()
for i in range(A + B + 1):
	if i < A and S[i] == '-':
		print('No')
		return
	elif i == A and S[i] != '-':
		print('No')
		return
	elif i > A and S[i] == '-':
		print('No')
		return
print('Yes')


import re
z = re.split('\\s', input())
s = input()
print('Yes') if re.match('\\d{' + z[0] + '}-\\d{' + z[1] + '}', s) else print('No')


(A, B) = map(int, input().split())
S = list(input())
AB = [0] * 2
f = 0
for s in S:
	if s == '-':
		f = 1
		continue
	AB[f] += 1
if AB[0] == A and AB[1] == B:
	print('Yes')
else:
	print('No')


(a, b) = list(map(int, input().split()))
s = input()
num = list(map(str, list(range(10))))
flag = True
for i in range(a):
	if s[i] not in num:
		flag = False
if s[a] != '-':
	flag = False
for i in range(a + 1, a + b + 1):
	if s[i] not in num:
		flag = False
if flag:
	print('Yes')
else:
	print('No')


import sys
(A, B) = [int(x) for x in input().split()]
S = list(input())
for i in range(A + B + 1):
	if i == A:
		if S[i] != '-':
			print('No')
			return
	elif str.isdecimal(S[i]) == False:
		print('No')
		return
print('Yes')


(a, b) = map(int, input().split())
N = input()
print('Yes' if N[a] == '-' and N.count('-') == True else 'No')


(a, b) = map(int, input().split())
s = list(input())
flag = 'No'
if s[a] == '-' and s.count('-') == 1:
	flag = 'Yes'
print(flag)


(a, b) = map(int, input().split())
s = input()
print(['No', 'Yes'][s[0:a].isdigit() and s[a] == '-' and s[a + 1:].isdigit()])


(a, b) = map(int, input().split())
s = input()
s1 = s[:a] + s[a + 1:]
print('YNeos'['-' in s1 or '-' != s[a]::2])


import math
is_no = 0
(num1, num2) = list(map(int, input().split()))
str1 = input()
table = list(str1)
count = 0
for i in range(len(str1)):
	if table[i] == '-':
		count += 1
	else:
		continue
if count == 1 and table[num1] == '-':
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
s = input()
if '-' in s[:a] or '-' in s[-b:] or s[a] != '-':
	print('No')
else:
	print('Yes')


(A, B) = map(int, input().split())
S = input()
if S.find('-') == S.rfind('-') == A:
	print('Yes')
else:
	print('No')


import sys
(A, B) = map(int, input().split())
S = input()
for i in range(A + B + 1):
	if i == A:
		if S[i] != '-':
			print('No')
			return
	elif not S[i] in '0123456789':
		print('No')
		return
print('Yes')


(A, B) = map(int, input().split())
S = str(input())
for i in range(len(S)):
	if i < A:
		if not S[i].isnumeric():
			print('No')
			return
	elif i == A:
		if S[i] != '-':
			print('No')
			return
	elif not S[i].isnumeric():
		print('No')
		return
print('Yes')


(a, b) = map(int, input().split())
s = input()
if len(s) == a + b + 1 and s[a] == '-':
	s = s.replace('-', '')
	if s.isdecimal() and len(s) == a + b:
		print('Yes')
		return
print('No')


(a, b) = map(int, input().split())
s = input()
if s.count('-') == 1:
	if s[a] == '-':
		print('Yes')
		exit()
print('No')


(a, b) = map(int, input().split())
s = input()
if s[a] == '-' and str.isdecimal(s[:a] + s[-b:]):
	print('Yes')
else:
	print('No')


(a, _) = map(int, input().split())
s = input()
print('YNeos'[1 - all([s[:a].isdigit(), s[a] == '-', s[a + 1:].isdigit()])::2])


(A, _) = input().split()
S = input()
flag = S.count('-') == 1 and S.find('-') == int(A)
print('Yes' if flag else 'No')


lst = input().split()
A = int(lst[0])
B = int(lst[1])
s = input()
if len(s) == A + B + 1 and s.count('-') == 1 and (s[A] == '-'):
	print('Yes')
else:
	print('No')


(a, b, s) = open(0).read().split()
if (int(a), int(b)) == tuple(map(len, s.split('-'))):
	print('Yes')
else:
	print('No')


(A, B) = map(int, input().split())
S = input()
print('Yes') if (S.find('-') == A) & (S.count('-') == 1) else print('No')


(a, b, s) = open(0).read().split()
a = int(a)
print('NYoe s'['-' not in s[:a] + s[a + 1:] and s[a] == '-'::2])


(a, b) = input().split()
a = int(a)
S = input()
print(['No', 'Yes'][S[a] == '-' and S.count('-') == 1])


(a, b) = map(int, input().split())
s = list(input())
if s[a] == '-':
	c = 0
	for i in range(0, a + b + 1):
		if s[i].isdecimal() == True:
			c = c + 1
	if c == a + b:
		print('Yes')
	else:
		print('No')
else:
	print('No')