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

Submission status: Accepted

Solution code:
a, b = 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")

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    A, B = map(int, readline().split())
    s = input()
    nums = "0123456789"

    def judge():
        if s.count("-") == 1:
            if s[A] == "-":
                first, second = s.split("-")
                for c in first:
                    if c not in nums:
                        return False
                for c in second:
                    if c not in nums:
                        return False
                return True
        return False

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

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

if len(S) != A+B+1:
    print("No")
    exit()

for i in range(A+B+1):

    if i == A:
        if S[i] != "-":
            print('No')
            exit()
    else:
        if not('0' <= S[i] <= '9'):
            print('No')
            exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")
      exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = 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 ("-" not in s[:a])&("-" not in s[a+1:])&(s[a]=="-"):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
A, B = 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')
        exit()

print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

s1 = s[:a]
s2 = s[a:a+1]
s3 = s[a+1:]

if s2 == '-':
    if str.isdigit(s1) and len(s1) == a and str.isdigit(s3):
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

ok = True
ok = ok and  s[0:a].isdecimal()
ok = ok and s[a] == '-'
ok = ok and s[a+1:].isdecimal()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import re
A, B = (int(x) for x in input().split())
S = input()
match = '\d' * A + '-' + '\d' * B 
ptn = re.compile(match)
print('Yes' if ptn.search(S) != None else 'No')

Submission status: Accepted

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

if S.count('-') == 1 and S[A] == '-':
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
t=True
if s[a]=="-":
    x,y=s[:a],s[a+1:]
    if "-" in x or "-" in y:
        t=False
else:
    t=False
print("Yes" if t else "No")

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
t=True
if s[a]=="-":
    x,y=s[:a],s[a+1:]
    if len(x) != a or len(y) != b or "-" in x or "-" in y:
        t=False
else:
    t=False
print("Yes" if t else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans="No"

if s[a]=="-":
  if s[:a].isdigit() and s[a+1:].isdigit():
    ans="Yes"

print(ans)

Submission status: Accepted

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

m = re.match(r'^(\d+)\-(\d+)$', S)

if m:
    if len(m.groups()[0]) == A and len(m.groups()[1]) == B:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

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

def is_int(s):
    try:
        int(s)
        return True
    except ValueError:
        return False

if is_int(s[0:a]) and is_int(s[a+1:a+b+2]) and s[a] == "-":
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if s[a] != '-':
  ans = 'No'
else:
  cnt = s.count('-')
  if cnt > 1:
    ans = 'No'
  else:
    ans = 'Yes'
    
print(ans)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=input()
if "0"<=S[0:A] and S[0:A]<="9"*A:
  if S[A:A+1]=="-" :
    if "0"<=S[A+1:A+B+1] and S[A+1:A+B+1]<="9"*B :
      print("Yes")
      exit()
print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b = 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())
s = input()

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

Submission status: Accepted

Solution code:
def main():
    A, B = map(int, input().split())
    S = str(input())
    f = 0
    
    for i in range(A):
        if S[i].isnumeric():
            continue
        else:
            print('No')
            return
    
    if S[A] != '-':
        print('No')
        return
    
    for i in range(A+1, A+B+1):
        if S[i].isnumeric():
            continue
        else:
            print('No')
            return
    print('Yes')
    
main()

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
s=input()
d=s.count('-')
if('-' in s):
    f=s.index('-')
if(d==1 and f==x):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a,b=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())
S = input()

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

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

for i in range(A + B + 1):
    s = S[i]
    if s == '-' and i != A:
        print('No')
        exit()

print("Yes")

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=list(input())
a=[]
for i in range(len(S)):
    if 0<=i and i<=A-1:
        if S[i].isdecimal()==True:
            a.append('Yes')
        else:
            a.append('No')
    elif i==A:
        if S[i]=='-':
            a.append('Yes')
        else:
            a.append('No')
    elif i>A: 
        if S[i].isdecimal()==True:
            a.append('Yes')
        else:
            a.append('No')
if 'No' in a:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = list(input())
if len(S) != A+B+1:
    print('No')
    exit()
for i,s in enumerate(S):
    if i!=A and s != '-':
        continue
    if i==A and s == '-':
        continue
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
cnt = 0
y = ['0','1','2','3','4','5','6','7','8','9']

for i in range(a+b+1):
    if i == a:
        if s[a] == '-':
            cnt +=1
    else:
        if s[i] in y:
            cnt += 1
        
if cnt == (a+b+1):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# coding = SJIS

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

num = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]

for i in range(a):
    if s[i] not in num:
        print("No")
        exit()
if s[a] != "-":
    print("No")
    exit()
for i in range(b):
    if s[(-1) * i] not in num:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=str(input())
ans="Yes"
num="0","1","2","3","4","5","6","7","8","9"
for i in range(A+B+1):
    if i<A:
        if S[i] not in num:
            ans="No"
            break
    elif i==A:
        if S[i]!="-":
            ans="No"
            break
    elif i<=A+B:
        if S[i] not in num:
            ans="No"
            break
print(ans)

Submission status: Accepted

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

for i in range(A):
    if S[i].isdecimal():
        pass
    else:
        print("No")
        exit()

if S[A] == "-":
    pass
else:
    print("No")
    exit()

for i in range(A + 1, A + B + 1):
    if S[i].isdecimal():
        pass
    else:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

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

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

Submission status: Accepted

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

NUM = [str(i) for i in range(10)]
isCorrect = True

if S_h != '-':
    isCorrect = False

for i in S:
    flag = 0
    for j in NUM:
        if i==j:
            flag = 1
    if flag == 0:
        isCorrect = False

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

Submission status: Accepted

Solution code:


def main():
    A, B = map(int, input().split())
    s = input()
    numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    flag = True
    if len(s) == A + B + 1:
        if s[A] != '-':
            flag = False
        for a in s[:A]:
            if a not in numbers:
                flag = False
        for b in s[A+1:]:
            if b not in numbers:
                flag = False
    else:
        flag = False
    
    if flag:
        print("Yes")
    else:
        print("No")
        

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    A, B = [int(item) for item in input().split()]
    S = input()

    if S[A] == '-' and len(S) >= 3:
        if '-' in S[:A] or '-' in S[-1*B:]:
            print('No')
        else:
            print('Yes')
    else:
        print('No')
if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
s = S.replace('-', '')

if len(s) == A + B and S[A] == '-':
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:

def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())

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

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




if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if s[a] != '-':
    print('No')
    exit()
try:
    int(s[:a])
    int(s[a + 1:])
except:
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = input()
S = list(s)
c = 0
for i in S:
    if i == "-":
        c += 1
        if c > 1:
            print("No")
            exit()
            
if s.isdecimal() is True:
    print("No")
    exit()
    
if len(s) != a + b + 1:
    print("No")
    exit()
    
if s[:a].isdecimal() is True and S[a] == "-":
    print("Yes")
    
else:
    print("No")

Submission status: Accepted

Solution code:
a = input().split()
b = input()
c = int(0)

for i in range(int(a[0])):
  if b[i] == "-":
    c = 1
  else:
    pass

if b[int(a[0])] != "-":
  c = 1

for i in range(int(a[0]) + 1, int(a[0]) + int(a[1]) + 1):
  if b[i] == "-":
    c = 1
  else:
    pass

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = str(input())
#suji = [str(i) for i in range(10)]
ans = True
for i in range(a+b+1):
    if i==a:
        if s[i]!='-':
            ans = False
    else:
        if s[i]=='-':
            ans = False
if ans:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

count = "No"

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

print(count)

Submission status: Accepted

Solution code:
a, b = list(map(int, input().split()))
s = input()
flag = True
for i in range(a + b + 1):
    try:
        if i < a or i > a:
            if str(int(s[i])) == s[i]:
                pass
            else:
                flag = False
                break
        else:
            if s[i] == '-':
                pass
            else:
                flag = False
                break
    except:
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

num = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

flag = "Yes"
for i in range(A):
    if S[i] not in num:
        flag = "No"

if S[A] != '-':
    flag = "No"

for j in range(B):
    if S[j+A+1] not in num:
        flag = "No"

print(flag)

Submission status: Accepted

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

if (S[:A].isdecimal()) and (S[A]=='-') and (S[A+1:].isdecimal()):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
s = str(input())
num = ['0','1','2','3','4','5','6','7','8','9']
m = 0
for i in range(a+b+1):
    if i == a:
        if s[i] == '-':
            m += 1
    else:
        for h in num:
            if s[i] == h:
                m += 1
if m == a+b+1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

is_A = S[:A]
is_B = S[A+1:A+B+1]
bar = S[A]

if ('-' in is_A) or ('-' in is_B) or bar != '-':
    print('No')
else :
    print('Yes')

Submission status: Accepted

Solution code:
import string

A,B=list(map(int, input().split()))
S=input()
a=S[:A]
hi=S[A]
b=S[A+1:]
L=string.digits

if all(a[_] in L for _ in range(A)) and \
   all(b[_] in L for _  in range(B)) and \
   hi=='-':
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b = rm()
s = rr()
for i in range(a):
    if s[i] not in '0123456789':
        print('No')
        exit()
for i in range(b):
    if s[a+1+i] not in '0123456789':
        print('No')
        exit()
if s[a] != '-':
  print('No')
  exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
l = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
s = input()
flag = True
for i in range(len(s)):
    if i == a:
        if s[i] != '-':
            flag = False
    elif s[i] not in l:
        flag = False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=input()
if S[A]=="-":
  for i in range(A):
    if S[i]=="-":
      print("No")
      break
  else:
    for j in range(B):
      if S[-j-1]=="-":
        print("No")
        break
    else:
      print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
for i in range(A):
    if not S[i].isdecimal():
        print('No')
        exit()
if S[A] != '-':
        print('No')
        exit()
for i in range(A+1, A+B+1):
    if not S[i].isdecimal():
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
import re

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

m = '\d'*A + '-' + '\d'*B

if re.match(m,S):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]


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

ans = "Yes"
for i in range(len(s)):
    if (i == a):
        if (s[i] != "-"):
            ans = "No"
            break
    else:
        if (s[i] >= "0" and s[i] <= "9"):
            pass
        else:
            ans = "No"
            break
print(ans)

Submission status: Accepted

Solution code:
import os
import sys
import math
if os.environ.get("DEBUG") is not None:
    sys.stdin = open("in.txt", "r")
rl = sys.stdin.readline

a, b = map(int, rl().split())
s = rl().rstrip("\n")

failed = False
for i in range(0, a):
    if not 48 <= ord(s[i]) <= 57:
        failed = True
        break
if s[a] != "-":
    failed = True
for i in range(a + 1, len(s)):
    if not 48 <= ord(s[i]) <= 57:
        failed = True
        break
print("No" if failed else "Yes")

Submission status: Accepted

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

Submission status: Accepted

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

if S[A] == "-" and S[0:A].isdecimal() and S[A+1:A+B+1].isdecimal():
  flag = True

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = 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())
N=list(str(input()))
if N[a]=="-":
  N.pop(a)
  if "-" in N:
    print("No")
  else:
    print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
A, B = map(int, input().split())
S = input()
for i in range(len(S)):
    if i<A:
        if S[i].isdigit():
            pass
        else:
            print("No")
            break
    elif i==A:
        if S[i]!="-":
            print("No")
            break
    else:
        if S[i].isdigit():
            pass
        else:
            print("No")
            break
else:
    print("Yes")

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input().strip()
try:
    if int(S[:A]) >= 0 and int(S[-B:]) >= 0 and S[A] == "-":
        print("Yes")
    else:
        print("No")
except:
    print("No")

Submission status: Accepted

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

if len(S) == 2 and len(S[0]) == a:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

sa = S[:A]
sb = S[A+1:]

if sa.isdecimal() and sb.isdecimal() and S[A]=="-":
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

code = S[:A] + S[-B:]

print('Yes' if code.isdecimal() and S[A] == '-' else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

a, b = inintm()
s = input()

x = 0
y = 0

try:
    x = int(s[:a])
    y = int(s[a+1:])
except:
    print("No")
    exit()

if s[a] == "-":
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

if len(S) != A+B+1:
  print(0)
  print('No')
  exit()
  
for i in range(A):
  if S[i] not in set(map(str,list(range(10)))):
    print('No')
    exit()
if S[A] != '-':
  print('No')
  exit()
for i in range(A+1,A+B+1):
  if S[i] not in set(map(str,list(range(10)))):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = [int(a) for a in input().split()]
S = input()

for i, c in enumerate(S):
    if i == A:
        if c != '-':
            print('No')
            exit()
    else:
        if c < '0' or '9' < c:
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
A,B= map(int, input().split())
str1 = input()
li = list(str1)
flag = True
flag2 = False
for i in range(len(li)):
    if li[i] == '-' and i != A:
        flag = False
    elif  li[i] == '-':
        flag2 = True
if flag and flag2:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a,b = list(map(int, input().strip().split()))
s= input().strip()
f="Yes"
if s[a]!='-':
    f="No"

for i in range(a):
    if  s[i]=="-":
        f="No"
        break

for i in range(a+1,a+b+1):
    if  s[i]=="-":
        f="No"
        break
print(f)

Submission status: Accepted

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

if(S[A] == "-"):
    S = S[:A] + S[A+1:]
    if(S.isdecimal()):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B = map(int, readline().split())
    S = readline().strip()
    
    if S.count('-') != 1:
        print('No')
        return
    
    if S.index('-') == A:
        print('Yes')
    else:
        print('No')
    
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
n=len(s)
l=list("0123456789")

f=0
for i in range(a):
    if s[i] in l:
        f+=1
    
if s[a]=="-":
    
    f+=1

for i in range(b):
    if s[-1-i] in l:
        f+=1
    
print("Yes" if f==n else "No")