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: introductory

Starter code:

Solutions:
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
  else:
    if s[i] == '-':
      ans = 'No'
      break
print(ans)


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())
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")

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

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

if len(s.split('-')) == 2 and s[a] == '-':
    print('Yes')
else:
    print('No')

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')

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")

import re
a,b = input().split()
s = input()
if re.match(r'\d{' + a + '}-\d{' + b + '}', s):
    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
  else:
    if(str.isdecimal(S[i])==False):
      print('No')
      return
print('Yes')

a, b = map(int, input().split())
s = input()
t = s.split('-')
print('Yes' if s[a] == '-' and len(t) == 2 else '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
  else:
    if ch not in dg:
      postcode = False
      break
      
if postcode:
  print("Yes")
else:
  print("No")

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")

A, B = list(map(int, input().split()))
S = input()

if S[A] == '-' and '-' not in S[:A] and '-' not in S[-B:]:
    print('Yes')
else:
    print('No')


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 = 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()

if len(s)==a+b+1 and s[a]=="-" and s.count("-")==1:
    print("Yes")
else:
    print("No")

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

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
  else:
    if re.match(n_pattern, S[i]) is None:
      res = "No"
      break
  
print(res)


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

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 re
A,B = input().split()
S = input()

my_regex = r"\d{" + A + r"}-\d{"+ B +r"}"

if re.fullmatch(my_regex, S) == None:
  print('No')
  
else:
  print('Yes')

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 = map(int, input().split())
S = input()

if S.find("-") == S.rfind("-") == A:
  print("Yes")
else:
  print("No")

a, b = list(map(int, input().split()))
s = input()
ans = True
for i in range(a + b + 1):
    if s[a] != "-":
        ans = False
        break
    else:
        if 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=list(map(int,input().split()))
s=input()
if len(s) != a+b+1:
    print('No')
    return
else:
    if 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())
s = input()
if s[a] == '-' and s.count('-') == 1:
  print("Yes")
else:
  print("No")

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")

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')

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)


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')

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


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


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

if s[a] == "-" and len(s) == a + b + 1 and "-" not in s[:a] and "-" not in s[a+1:]:
  print("Yes")
else:
  print("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')

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 = map(int, input().split())
s = input()

if ("-" not in s[:a])&("-" not in s[a+1:])&(s[a]=="-"):
    print("Yes")
else:
    print("No")

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

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")

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
  else:
    if s[i] not in e:
      print("No")
      return

print("Yes")

#Postal Code
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 = 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
  else:
    if not S[i].isnumeric():
      print("No")
      return
print("Yes")

import re

a, b = map(int, input().split())
s = input()
s = re.sub(r"[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()
print("Yes" if S[A] == "-" and S.count("-") == 1 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, B = list(map(int, input().split()))
S = input()
print(("Yes" if S[A] == "-" and S.count("-") == 1 else "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 = str(input())

if len(s)== a+b+1 \
    and s[a:a+1] =='-' \
    and str.isdecimal(s[0:a]) \
    and str.isdecimal(s[a+1:a+1+b]):
    print('Yes')
else:
    print('No')

a,b = map(int, input().split())
s = str(input())
#print(s[a+1])

if s[a] == "-" and s.count("-") == 1:
    print("Yes")
else:
    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())
l=input().split('-')
if(len(l[0])==a and len(l[1])==b):
  print("Yes")
else:
  print("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 = input()
if s.count('-') == 1 and s[a] =='-':
    print('Yes')
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())
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()
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')

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')

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()

result = 'Yes'
if '-' in S[:A]:
    result = 'No'
if '-' not in S[A]:
    result = 'No'
if '-' in S[A+1:]:
    result = 'No'

print(result)

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
    else:
        if not S[i] in '0123456789':
            print('No')
            return
print('Yes')

import re
a,b = list(map(int,input().split()))
s = input()
if re.search(r"[0-9][0-9]*",s[0:a]):
  if s[a]=="-":
    if re.search(r"[0-9][0-9]*",s[(a+1):]):
      print("Yes")
      return
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 = list(map(int,input().split()))
s =input()
for i in range(a+b+1):
    if i == a:
        if s[i] !='-':
            print('No')
            break
    else:
        if s[i]=='-':
            print("No")
            break
            
        else:
            if int(s[i])<0 or 9<int(s[i]):
                print("No")
                break
else:
    print('Yes')

#!/usr/bin/env python3
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 = (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 = input()
t = s[:a] + s[a+1:]

if s[a]=='-' and '-' not in t:
	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)

a,b=list(map(int,input().split()))
s=input()
if len(s) != a+b+1:
    print('No')
    return
else:
    if s[a] != '-':
        print('No')
        return
    elif s.count('-')!=1:
        print('No')
        return
print('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()
t = s[:a] + s[a+1:]

if s[a]=='-' and '-' not in t:
	print("Yes")
else:
  print("No")

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(r'[0-9]', S[i]):
        count += 1

if count == A+B:
    print('Yes')
else:
    print('No')

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

if ("-" in s) and s.count("-") == 1:
    s = s.split("-")
    if len(s[0]) == (a) and len(s[1]) == b:
        print("Yes")
    else:
        print("No")

else:
    print("No")

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()

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 = 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')
      


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")
    else:
        print("No")
else:
    print("No")

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()
print("Yes" if s[:a].isdecimal() and s[a] == "-" and s[a+1:].isdecimal() else "No")


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
    else:
        if not('0' <= S[i] <= '9'):
            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')


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

a, b = map(int, input().split())
s = input().rstrip().split('-')
if len(s) == 2 and len(s[0]) == a and len(s[1]) == b:
    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")

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

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, 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=input()
if S[:A].isdecimal() and S[A]=='-' and S[A+1:].isdecimal():
    print('Yes')
else:
    print('No')

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')

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

a,b=map(int,input().split())
s=input().split("-")
print("Yes" if len(s)==2 and len(s[0])==a and len(s[1])==b 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"
        else:
            if s[i] == "-":
                return "No"
    return "Yes"
print(f())

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')


# -*- coding:utf-8 -*-
A,B = map(int,input().split())
S = input()



if S[:A].isdecimal() and S[A]=="-" and S[A+1:].isdecimal():
    print("Yes")
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")

# 33
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)

import re


def answer(a: int, b: int, s: str) -> str:
    pattern = fr'\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()

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()
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")