Problem:


Score : 200 points

Problem Statement

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 1

3 4
269-6650

Sample Output 1

Yes

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

Sample Input 2

1 1
---

Sample Output 2

No

S contains unnecessary -s other than the (A+1)-th character, so it does not follow the format.

Sample Input 3

1 2
7444

Sample Output 3

No



Sample input:
3 4
269-6650


Sample output:
Yes

Submission status: Accepted

Solution code:
def eval(A, B, S):
	if len(S) != A + B + 1:
		return False
	if S[A] != '-':
		return False
	for i in range(A):
		if not S[i].isdigit():
			return False
	for i in range(B):
		if not S[i + A + 1].isdigit():
			return False
	return True


A, B = map(int, raw_input().split())
S = raw_input()
if eval(A, B, S):
	print "Yes"
else:
	print "No"

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()

isCorrect = True
for i, c in enumerate(S):
    if (i<A or i>A):
        if not c.isdigit():
            isCorrect = False
            break
    elif c != "-":
        isCorrect = False
        break

print("Yes" if isCorrect else "No")

Submission status: Accepted

Solution code:
a, b = [int(i) for i in input().split()]
s = input()

for i in range(len(s)):
    if i == a:
        if s[i] != "-":
            print("No")
            exit()
    elif not ord("0") <= ord(s[i]) <= ord("9"):
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
import re

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

p = re.compile(r"^[0-9]{%d}-[0-9]{%d}" % (A, B))
print("Yes" if p.match(S) else "No")

Submission status: Accepted

Solution code:
#!usr/bin/env python3
#! = map(int, input().split())
#! = [int(input()) for i in range()]

#A
"""
n,l=map(int, input().split())
s=[list(input()) for i in range(n)]
s.sort()
for i in s:
    for j in i:
        print(j,end="")
print()
"""

#B
a,b = map(int,input().split())
s = list(input())
k = s[:a]
asfpod = list("11234567890")
if s[a] != "-":
    print("No")
    quit()
d = s[a+1:]
for i in k:
    if i not in asfpod:
        print("No")
        quit()
for i in d:
    if i not in asfpod:
        print("No")
        quit()
print("Yes")
#C

#D

#E

#F
"""
n = int(input())
a = list(map(int, input().split()))
l = 0
r = 0
if n == 1:
    print(1)
    quit()
ans = 0
flag = [False for i in range(200000)]
flag[a[0]] = True
while r < n-1:
    r += 1
    while flag[a[r]]:
        flag[a[l]] = False
        l += 1
    ans = max(ans, r-l+1)
    flag[a[r]] = True
print(ans)
"""

#G
"""
r,c,d = map(int, input().split())
stage = [list(map(int, input().split())) for i in range(r)]
lis = []
for i in range(r):
    for j in range(c):
        lis.append([stage[i][j],i,j])
lis.sort(key = lambda x:-x[0])

for l,y,x in lis:
    if y+x <= d and (y+x-d)%2 == 0:
        print(stage[y][x])
        quit()
"""
#H

#I
"""
mod = 1000000007

def pow(a,b,c):
    n = 1
    m = a
    v = b
    while v > 0:
        if v%2 == 1:
            n *= m%c
            n %= c
        m *= m
        m%= c
        v //= 2
    return n%c

n = int(input())
a = list(map(int, input().split()))
l = 0
r = 0
ans = 0
flag = False
while r < n-1:
    while a[r] != -1:
        r += 1
        if r == n-1:
            break
    l = r-1
    while a[r] == -1:
        flag = True
        r += 1
    if a[r] != a[l]:
        su = 1
        s = a[r]-a[l]+1
        for i in range(1, r-l):
            su *= (s+i-1)
            su %= mod
            su *= pow(i, mod-2, mod)
            su %= mod
        ans += su
        ans %= mod
if ans == 0 and flag:
    ans = 1
print(ans)
"""
#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

Solution code:
A, B =map(int, input().split())
S = input()
NUM = list(range(10))
X = 0
while X != A+B+1:
    if X == A:
        if S[X] != "-":
            print("No")
            quit()
        X += 1
    else:
        if S[X] == "-":
            print("No")
            quit()
        if int(S[X]) in NUM:
            X += 1
        else:
            print("No")
            quit()
print("Yes")

Submission status: Accepted

Solution code:
import re

l = list(map(int, input().split()))
a = l[0]
b = l[1]

s = input()

fi = re.findall("-", s)

if len(fi) != 1:
    print("No")
    quit()

index = s.find("-")

for i, c in enumerate(s):
    if i == a:
        if c != "-":
            print("No")
            quit()

    else:
        if c.isdigit() == False:
            print("No")
            quit()

print("Yes")

Submission status: Accepted

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

if s.count("-") != 1:
  print("No")
elif s.index("-") != a:
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

p = 0
for i in range(len(s)):
    if a == i:
        if s[i] == "-":
            p = 1
    else:
        if s[i] == "-":
            print("No")
            exit()

if p == 0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re


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

if re.match(r'\d{%d}-\d{%d}' % (A, B), S):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = list((input()))
x = False
y = False
cnt = 0
if S[A] == '-':
    S.pop(A)
    x = True
for i in range(A + B):
        if S[i].isdecimal():
            cnt += 1
if cnt == A + B:
    y = True
if x and y == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a, b = map(int,input().split())
s = input()
d1 = False
d2 = False
if s[a] == '-':
    d1 = True
cnt = 0
for i in range(a+b+1):
    if s[i].isdecimal():
        cnt += 1
if cnt == a + b:
    d2 = True

if d1 and d2:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def isdigit(s):
  return all(c in '0123456789' for c in s)

def check(s, a, b):
  if len(s) != a + b + 1:
    return False
  
  if not isdigit(s[:a]):
    return False
  
  if s[a] != '-':
    return False
  
  if not isdigit(s[-b:]):
    return False
  
  return True
  
a, b = map(int, input().split())
s = input()
if check(s, a, b):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
A, B = [int(i) for i in input().split()]
S = input()
if len(S) == A+B+1 and S[A] == '-' and S[:A].isdecimal() and S[A+1:].isdecimal():
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
if '-' not in s or s.count('-')>1 or s[0]=='-' or s[-1]=='-':
    print('No')
    exit()
p=s.split('-')
print('No' if s[a]!='-' or len(p[0])!=a or len(p[1])!=b else 'Yes')

Submission status: Accepted

Solution code:
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")
      sys.exit()
  else:
    if ord(s[i])-ord('0')<0 or ord(s[i])-ord('0')>9:
      print("No")
      sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
from sys import stdin


def main() -> None:
    a, b = [int(s) for s in input().split()]
    s = next_str()
    flg = False

    for i, c in enumerate(s):
        if i == a:
            if c != '-':
                flg = True
        else:
            if c == '-':
                flg = True

    print(["Yes", "No"][flg])


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a,b = map(int, input().split())
s = input()

res='No'

if len(s) == (a+b+1):
  if s[a] == '-':
    if s.count('-') == 1:
      res = 'Yes'
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
if (len(s)==a+b+1)&(s[a]=='-')&(s.count('-')==1):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
i = S.find("-")
if i == -1:
    print("No")
    exit()

s = list(S)
if not(i == A):
    print("No")
    exit()
if not(len(s)-(i+1) == B):
    print("No")
    exit()
for index in range(len(s)):
    if index == i:
        continue
    if s[index] == "-":
        print("No")
        exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

if s[a] != '-':
    print('No')
elif ''.join(s[:a]).isdigit() and ''.join(s[a + 1:]).isdigit():
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


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

    if s[:a].isdigit() and s[a:a + 1] == '-' and s[a + 1:].isdigit():
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = list(input())
T = ["0","1","2","3","4","5","6","7","8","9"]
flag = 0
for i in range(len(S)) :
    if 0 <= i <= A-1 or A+1 <= i <= len(S)-1 :
        if S[i] in T :
            continue
        else :
            flag = 1
            break
    else :
        if S[i] != "-" :
            flag = 1
            break
if flag == 0 :
    print("Yes")
else :
    print("No")

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = input()
sp = S.split('-')
if len(sp) != 2:
    print('No')
elif not(sp[0].isdigit() and sp[1].isdigit()):
    print('No')
else:
    print('Yes' if len(sp[0])==A and len(sp[1])==B else 'No')

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=input()

check=1

for i in range(A):
    if S[i]=="-":
        check=0

if S[A]!="-":
    check=0

for i in range(A+1,A+B+1):
    if S[i]=="-":
        check=0


if check==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b = li()
s = lc()

ok = True

for i, si in enumerate(s):
    if i == a:
        if si != "-":
            ok = False
    else:
        if si == "-":
            ok = False
            
if ok:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
c = input()
print("YNeos"[not("-" not in c[:a] and "-" in c[a:a+1] and "-" not in c[a+1:]) ::2])

Submission status: Accepted

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

Submission status: Accepted

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

print(['No','Yes'][s[a]=='-'and s.count('-')==1])

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S =input()
accept = None

for i, c in enumerate(S):
    if i == A:
        if c != "-":
            accept = False
            break
    else:
        if c not in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]:
            break
        elif i == A+B+1-1:
            accept = True
        else:
            accept = False

if accept:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
S = input()

if len(S) != A+B+1 or S.count("-") != 1:
  print("No")
else:
  if S[A] != "-":
    print("No")
  else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def all_num(text):
    for c in text:
        if not c in "1234567890":
            return False
    return True

a, b = [int(m) for m in input().split(" ")]
s = input()

print("Yes" if all([all_num(s[:a]), s[a] == "-", all_num(s[a+1:a+1+b])]) else "No")

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
S = input()

if (S[:A].isdigit() == True) and\
    (S[A] == "-")            and\
    (S[-B:].isdigit() == True):
        print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math as M
A,B=map(int,input().split(' '))
list=list(map(str,input().split(('-'))))
if list.__len__() != 2:
    print("No")
else:
   if list[0].__len__()==A and list[1].__len__()==B:
       print("Yes")
   else:
       print("No")

Submission status: Accepted

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

if len(s) != a + b + 1 or s[a] != "-":
    print("No")
elif "-" in s[:a] or "-" in s[a + 1:a + b + 1]:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = list(input())
count = 0
if S[A] == "-" and S.count("-") == 1:
  S.pop(A)
  S = [int(s) for s in S]
  for i in range(A+B):
    if 0<=S[i]<=9:
      count += 1
      continue
    else:
      print("No")
      break
else:
  print("No")
if count == A+B:
  print ("Yes")

Submission status: Accepted

Solution code:
a, b = map(int,input().split())
s = list(input())
if s.pop(a) != "-":
  print("No")
  exit()
if "".join(s).isdigit():
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

if s.count("-") == 1 and s.index("-") == a:
    print("Yes")

else:
    print("No")

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = list(input())
flag = True
L = ['1','2','3','4','5','6','7','8','9','0']
if (S[A] == '-'):
  del S[A]
  for i in range(len(S)):
    if (S[i] not in L):
      flag = False
      break
else:
  flag = False
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
listS = list(input())

if listS[a] == "-":
    index=0
    while index < len(listS):
        if index==a:
            pass
        else:
            if listS[index] in ["0","1","2","3","4","5","6","7","8","9"]:
                pass
            else:
                print("No")
                break
        index+=1
    if index == len(listS):
        print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
ans = True
a, b = map(int, input().split())
s = input()
try:
    astr, bstr = s.split('-')
    x = int(astr)
    x = int(bstr)
    if len(s) != a + b + 1: ans = False
    if len(astr) != a: ans = False
    if len(bstr) != b: ans = False
except: ans = False
    
print('Yes' if ans else 'No')

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
s = str(input())
list_pre = []
list_post = []
count = 0
while count < a + b + 1:
    if s[count] == "-":
        count += 1
        break
    list_pre.append(s[count])
    count += 1
while count < a + b + 1:
    list_post.append(s[count])
    count += 1
if len(list_pre) == a and len(list_post) == b:
    if "-" in list_pre or "-" in list_post:
        print("No")
    else:
        print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input().split("-")
print(["No","Yes"][len(s[0])==a and len(s[1])==b])

Submission status: Accepted

Solution code:
a, b = list(map(int, input().split()))
s = input().split('-')

if len(s) != 2:
    print('No')
elif len(s[0]) == a and len(s[1]) == b:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = list(map(str,input().split("-")))
if A == len(S[0]) and B == len(S[1]) :
    print("Yes")
else :
    print("No")

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=list(input())
c=0
for i in range(a):
  d=s.pop(0)
  if d=='-':c+=1
d=s.pop(0)
if d!='-':c+=1
for i in range(b):
  d=s.pop(0)
  if d=='-':c+=1
if c==0:print('Yes')
else:print('No')

Submission status: Accepted

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

ans = 'Yes'

if S[A] != '-':
    ans = 'No'

if len(S) != A + B + 1:
    ans = 'No'

for i in range(len(S)):
    if i != A:
        if S[i] == '-':
            ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
a, b = [int(v) for v in input().split()]
s = input()

if s[:a].isdigit() and s[a] == '-' and s[a+1:].isdigit():
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
A,B = list(map(int,input().split()))

S = input()

s0 = ord('0')
ans ='Yes'
if len(S) == A+B+1 and S[A]=='-':
    for x in S[:A]+S[A+1:]:
        if s0 <= ord(x) and ord(x) <= s0+9:
            continue
        else:
            ans = 'No'
            break
else:
    ans='No'
print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()

if S.find('-') == A and S.count('-') == 1:
	if len(set(S) | set('0123456789')) == 11:
		print('Yes')
		exit()

print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split());s=input();print(['No','Yes'][s[a]=='-' and s.count('-')==1])

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
ans=True if s[:a].isdecimal() and s[-b:].isdecimal() and s[a]=="-" and len(s)==a+b+1 else False
print(['No','Yes'][ans])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
import sys

a,b = (int(_) for _ in input().split())
s = str(input())

if '-' not in s or s.count('-') > 1:
    print("No")
    sys.exit(0)

s1,s2 = s.split('-',1)
if len(s1) > 0 and len(s2) > 0 and a == len(s1) and b == len(s2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a, b = map(int, raw_input().split())
s = raw_input()
flag = False
for i in range(0, a+b+1):
	if s[i] == '-':
		if i == a:
			flag = True
		else:
			flag = False
			break
if flag:
	print 'Yes'
else:
	print 'No'

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

A,B = inpl()
S = input()

def solve():
	for i in range(A+B+1):
		if i == A:
			if S[i] != '-':
				return False
		else:
			if S[i] == '-':
				return False

	return True

if solve():
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ok(A, B, S):
    if len(S) != A + B + 1:
        return False
    if S.count("-") != 1:
        return False

    a, b = S.split("-")
    if len(a) != A or len(b) != B:
        return False

    return True


def main():
    A, B = map(int, input().split())
    S = input()
    if ok(A, B, S):
        print(Yes)
    else:
        print(No)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import re
a, b = map(str, input().split())
s = str(input())


postCode = re.match('[0-9]{'+a+'}-[0-9]{'+b+'}' , s)

if postCode:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import re

tmp = input().split(" ")
A = tmp[0]
B = tmp[1]
S = input()

postCode = re.match('[0-9]{'+A+'}-[0-9]{'+B+'}' , S)

if postCode:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
# vim: set fileencoding=utf-8:


def main():
    A, B = map(int, raw_input().split())
    S = raw_input()

    if len(S) == A + B + 1 and S[A] == "-" and S[0:A].isalnum() and S[A + 1:].isalnum():
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
S = input()

for i in range(A):
  if S[i] == '-':
    print("No")
    exit(0)

if S[A] != "-":
  print("No")
  exit(0)

for i in range(B):
  if S[A+i+1] == '-':
    print("No")
    exit(0)
    
print("Yes")

Submission status: Accepted

Solution code:
#84b
a,b=map(int,input().split())
s = input()

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

Submission status: Accepted

Solution code:
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
      break
  else:
    if not '0'<=s[i]<='9':
      flag=False
      break
print('Yes' if flag else 'No')

Submission status: Accepted

Solution code:
from collections import Counter
A,B=list(map(int, input().split()))
S=list(input())

print("Yes" if S[A]=='-' and Counter(S)['-']==1 else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
print((lambda o:"No" if o is None else "Yes")((lambda l:re.match("[0-9]{"+l[0]+"}-[0-9]{"+l[1]+"}",l[2]))(input().split(' ')+[input()])))

Submission status: Accepted

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

Submission status: Accepted

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

if len(S) == A+B+1 and S[A] == '-' and S.count('-') == 1:
    print('Yes')

else:
    print('No')

Submission status: Accepted

Solution code:
a,b=map(int, input().split())
s=input()
if len(s)!=a+b+1: print("No"); quit()
for i in range(a+b+1):
    if i==a:
        if s[i]!="-": print("No"); quit()
    else:
        if "0">s[i] or s[i]>"9": print("No"); quit()
print("Yes")

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
if '-' not in s or s.count('-')>1 or s[0]=='-' or s[-1]=='-':
    print('No')
    exit()

p=s.split('-')
print('No' if s[a]!='-' or len(p[0])!=a or len(p[1])!=b else 'Yes')

Submission status: Accepted

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

c = 0
for i in range(0,a):
    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':
        c = c+1
if s[a] == '-':
    c = c + 1
for i in range(a+1,a+b+1):
     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':
        c = c+1
if c == a+b+1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = input()
if S[0:A].isdigit() == True and S[A] == "-" and S[A+1:len(S)].isdigit() == True :
    print("Yes")
else :
    print("No")

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
is_num = all([s.isdecimal() for s in S[:A] + S[-B:]] + [S[A] == '-'])
print('Yes' if is_num else 'No')

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
t=s.split("-")
if len(t)!=2:
  print("No")
elif len(t)==2 and len(t[0])==a and len(t[1])==b:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = input()
flag = True

for i in range(A):
  if not '0' <= S[i] <= '9':
    flag = False

if S[A] != '-':
  flag = False

for i in range(B):
  if not '0' <= S[A+i+1] <= '9':
    flag = False

if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
a, b = input().split()
s = input()
pattern = r'[0-9]{{{}}}-[0-9]{{{}}}'.format(a, b)
if re.match(pattern, s):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import itertools

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

    try:
        s1 = int(s[:a])
        s2 = int(s[a+1:])
        s3 = s[a:a+1]
        if s3 == '-':
            print('Yes')
        else:
            print('No')
    except:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

A, B = (int(i) for i in input().split())
S = input()

a = S[0:A]
M = S[A]
b = S[A+1:]

for i in a:
    if i == "-":
        print("No")
        sys.exit()

if M != "-":
    print("No")
    sys.exit()

for i in b:
    if i == "-":
        print("No")
        sys.exit()

print("Yes")

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
numbers = list('0123456789')

flg = True
for i in range(a):
    if not(s[i] in numbers):
        flg = False
        break
if flg:
    if (s[a] != '-'):
        flg = False
if flg:
    for i in range(b):
        if not(s[a+1+i] in numbers):
            flg = False
            break
print('Yes' if flg else 'No')

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=list(input())
def r(x):
    if x=="0"or x=="1"or x=="2"or x=="3"or x=="4"or x=="5"or x=="6"or x=="7"or x=="8"or x=="9":
        return True
    else:return False
for i in range(a):
    if r(s[i]):continue
    else:
        print("No")
        exit()
if s[a]!="-":
    print("No")
    exit()
for i in range(b):
    if r(s[a+i+1]):continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
if s.count("-") != 1:
    print("No")
    exit()
A, B = s.split("-")
if a == len(A) and b == len(B):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
post = input()

if post[:A].isdigit() ==True and post[A]=='-' and post[A+1:].isdigit() ==True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
A, B = map( int, input().split())
S = input()
ans = 'Yes'
R = [str(i) for i in range(10)]
for i in range(A):
    if S[i] in R:
        pass
    else:
        ans = 'No'
if S[A] == '-':
    pass
else:
    ans = 'No'
for i in range(B):
    if S[A+1+i] in R:
        pass
    else:
        ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
a, b = (int(x) for x in raw_input().split())
s = raw_input()
try:
	int(s[:a])
	int(s[-b:])
	assert s[a] == '-'
except Exception:
	print "No"
else:
	print "Yes"

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = input()
if s.count('-') != 1:
    print('No')
else:
    print('Yes' if s.index('-') == a else 'No')

Submission status: Accepted

Solution code:
A, B = list(map(int, input().split()))
S = input()
a = S[0:A]
x = S[A]
b = S[A + 1:]
if list(a).count("-") == 0 and x == "-" and list(b).count("-") == 0:
	print("Yes")
else:
	print("No")