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

Submission status: Accepted

Solution code:
import re

a, b = [int(n) for n in input().split(' ')]
s = input()

pattern = '[0-9]{' + str(a) + '}-[0-9]{' + str(b) + '}'
print('Yes' if re.match(pattern, s) else 'No')

Submission status: Accepted

Solution code:
import sys
## io
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))
## dp
INIT_VAL = 0
MD2 = lambda d1,d2: [[INIT_VAL]*d2 for _ in range(d1)]
MD3 = lambda d1,d2,d3: [MD2(d2,d3) for _ in range(d1)]
## math
DIVC = lambda x,y: -(-x//y)
DIVF = lambda x,y: x//y

def main():
    a, b = MII()
    s = IS()
    d = {'1','2','3','4','5','6','7','8','9','0'}
    for i in range(a):
        if s[i] not in d:
            print('No')
            return None
    if s[a] != '-':
        print('No')
        return None
    for i in range(a+1,a+b+1):
        if s[i] not in d:
            print('No')
            return None
    print('Yes')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = input()
mae = S[:A]
haihun = S[A]
usiro = S[(A+1):]
ans = True
if (len(mae)==A)&(haihun =="-")&(len(usiro) == B)&(len(S) == A+B+1):
    ans = True
for i in range(len(mae)):
    if mae[i] == "-":
        ans = False
for i in range(len(usiro)):
    if usiro[i] == "-":
        ans = False
if haihun != "-":
    ans = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string
import sys

num = set(string.digits)

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 s[i] not in num:
            print("No")
            sys.exit()
print("Yes")

Submission status: Accepted

Solution code:

ma = lambda : map(int,input().split())
ni = lambda : int(input())

a,b = ma()
s = 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=input()
num=list("0123456789")
flg_1=0
flg_2=1
if S[A]=="-":
    flg_1=1
for i in range(len(S)):
    if i!=A:
        if S[i] not in num:
            flg_2=0
print("Yes" if flg_1 and flg_2 else "No")

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
for i in range(len(s)):
    if i == a:
        if s[i] != '-':
            print("No")
            break
    else:
        if not s[i] in [str(i) for i in range(10)]:
            print("No")
            break
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if S[A]!='-':
  print("No")
else:
  S.sort()
  #print(S)
  for i in range(1,len(S)):
    if S[i]=="-":
      print("No")
      break
  else:
    print("Yes")

Submission status: Accepted

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

n = [str(i) for i in range(10)]
flag = False
for i in range(A):
    if S[i] not in n:
        flag = True
        
if S[A] != '-':
    flag = True
    
for i in range(A+1, A+B+1):
    if S[i] not in n:
        flag = True
        
if flag:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys
# input = sys.stdin.readline

def main():
    a, b = map(int, input().split())
    p = input().split("-")
    if len(p) != 2:
        print("No")
        return
    else:
        l, r = p
        
    if len(l) == a and len(r) == b:
        print("Yes")
    else:
        print("No")

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

str_list = []
for i in S:
    str_list.append(i)

if str_list[A] == '-':
    str_list[A] = 0
    if not '-' in str_list:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    A,B=map(int,input().split())
    S=input().split('-')
    YesNo(len(S[0])==A and len(S[1])==B)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def is_postal_code(a, b, s):
  if len(s.split('-')) != 2:
    return False
  
  x, y = s.split('-')
  return x.isdigit() and len(x) == a and y.isdigit() and len(y) == b
  

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

if is_postal_code(A, B, S):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

count = 0
for i in range(len(S)):
    if (S[i] == '-'):
        count += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc084/tasks/abc084_b
a, b = map(int, input().split())

s = input()

if s.count('-') != 1:
    print('No')
else:
    l, r = s.split('-')
    if len(l) == a and len(r) == b:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
A,B=map(int, input().split())
S=str(input())
isHaihun = S[A]=="-"
num_list = "1234567890"
num_count = 0
for i in range(A+B+1):
  num_count = num_count + len([1 for x in num_list if x==S[i]])
isNum = num_count == A+B
if isHaihun & isNum:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
if S.count('-') != 1:
    print('No')
else:
    S = list(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()
flag=True
for i in range(0,a+b+1):
  if i<a and not s[i].isdecimal():
    flag=False
    break
  elif i==a and not s[i]=="-":
    flag=False
    break
  elif a<i and not s[i].isdecimal():
    flag=False
    break
if flag:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

n = len(s)

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

Submission status: Accepted

Solution code:
from collections import Counter
a,b = map(int,input().split())
s = input()

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

Submission status: Accepted

Solution code:
nums = "1234567890"
a, b = map(int, input().split())
s = input()
ok_flg = True
for i in range(a):
    if s[i] not in nums:
        ok_flg = False
        break
if s[a] != "-":
    ok_flg = False
for j in range(b):
    if s[a + 1 + j] not in nums:
        ok_flg = False
        break
if ok_flg == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

s = S.split("-")

ans = "Yes" if (A == len(s[0]) and B == len(s[1])) else "No"
print(ans)

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
inl=list(input())
try:
    for t in range(n):
        int(inl[t])
    for s in range(m):
        int(inl[n+1+s])
    if inl[n]=="-":
        print("Yes")
    else:
        print("No")
except Exception as e:
    print("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()
nums = [str(i) for i in range(10)]
if s[a] == "-":
    while True:
        for i in range(len(s)):
            if i == a:
                continue
            if not(s[i] in nums):
                print("No")
                quit()
        print("Yes")
        quit()
else:
    print("No")

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
bool = True
nums = [str(i) for i in range(10)]
if s[a] == "-":
    while True:
        for i in range(len(s)):
            if i == a:
                continue
            if not(s[i] in nums):
                print("No")
                quit()
        print("Yes")
        quit()
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=input()
if S[:A].isdecimal() and S[A+1:].isdecimal() and S.count('-')==1 and len(S)==(A+B+1):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
s = input()

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

Submission status: Accepted

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

a = S[:A]
c = S[A]
b = S[A:]

try:
    a = int(a)
    b = int(b)
    if c == '-':
        print('Yes')
    else:
        print('No')
except:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

ans = 'Yes'

if s.count('-') != 1 or s[a] != '-':
    ans = 'No'

print(ans)

Submission status: Accepted

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

if "-" in s[:a] or "-" in s[a+1:] or s[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 and "-" not in S[:A]+S[A+1:] and S[A] == "-":
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

nums = ["{}".format(i) for i in range(10)]

if s[a]!="-":
  print("No")
  exit()
  
for i in range(a+b+1):
  if i==a:
    continue
  elif s[i] in nums: 
    continue
  else:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
S = input()
flag = 0
k = [str(i) for i in range(10)]
for i in range(len(S)):
  if i == a:
    if S[i] == "-":
      continue
    else:
      flag += 1
      print("No")
      break
  else:
    if S[i] in k:
      continue
    else:
      flag += 1
      print("No")
      break
if flag == 0:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# abc084_b.py
A, B = map(int,input().split())
S = input()
ans ='Yes'
for i,c in enumerate(S):
    if i<A and c.isdecimal():
        continue
    elif i== A and c =="-":
        continue
    elif  i>A and c.isdecimal():
        continue
    else:
        ans = 'No'
        break
print(ans)

Submission status: Accepted

Solution code:
# solution
import io

n,m = map(int,input().split())
k = input()
j = k[:n] + k[n+1:]
    
p = (k[n] == '-') and (j.find('-') == -1)
result = 'Yes' if p else 'No'
print(result)

Submission status: Accepted

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

nums = [str(i) for i in range(10)]
for i in range(A):
    if S[i] not in nums:
        print("No")
        sys.exit()
if S[A] != "-":
    print("No")
    sys.exit()
for i in range(A+1, A+1+B):
    if S[i] not in nums:
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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


if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
def main():
    A, B = map(int, input().split())
    S = input()
    digit = [str(a) for a in range(10)]
    collect = True
    for i in range(len(S)):
        if i == A:
            if S[i] != "-":
                collect = False
                break
        else:
            if S[i] not in digit:
                collect = False
                break
    if collect == True:
        print("Yes")
    else:
        print("No")
main()

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
import re
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
A,B = map(int,input().split())
S = input()

kazu = "[0-9]"
pattern = kazu*A + "-" + kazu*B
kekka = re.fullmatch(pattern,S)

ans = "Yes"
if kekka is None:
    ans = "No"

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

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

if (len(s)==a+b+1 and s[a]=="-" and s[:a].isdigit() and s[a+1:].isdigit()):
  print("Yes")
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 S[A] == '-':
    if is_int(S[:A]) and is_int(S[A + 1:]):
        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:
    if S[A] == '-' and (S[:A]+S[A+1:]).isdigit():
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
a, b = list(map(int, input().split()))
s = list(input())
label = [str(i) for i in range(10)]

flag = True
for i in range(len(s)):
  if i < a and (not s[i] in label):
    flag = False
    break
  
  elif i - a == 0 and s[i] != "-":
    flag = False
    break
    
  elif 0 < i - a and i - a < b and (not s[i] in label):
    flag = False
    break
    
print("Yes" if flag else "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 or len(s[1]) != b:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input().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()
print('Yes' if s[a] == '-' and (s[:a] + s[a + 1:]).isdigit() else 'No')

Submission status: Accepted

Solution code:
# ABC 084: B – Postal Code
a, b = map(int, input().split())
s =input()
print('Yes' if s[a] == '-' and (s[:a] + s[a + 1:]).isdigit() else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(A+B+1):
    if i == A and S[i] == '-' or i != A and S[i] != '-':
        pass
    else:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
def myAnswer(A:int,B:int,S:list) -> str:
   hun = S.pop(A)
   if(hun != "-" or A+B!=len(S)): return "No"

   for s in S:
      asc = ord(s)
      if(asc < 48 or asc > 57): return 'No'
   return "Yes"

def modelAnswer():
   tmp=1
def main():
   A,B = map(int,input().split())
   S = list(input())
   print(myAnswer(A,B,S))

if __name__ == '__main__':
   main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = input()
flag = True
k = [str(i) for i in range(10)]
for i in range(A):
    if S[i] in k:
        continue
    else:
        flag = False
if S[A]=='-':
    pass
else:
    flag = False

for i in range(B):
    if S[A+1+i] in k:
        continue
    else:
        flag = False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
A,B = [int(x) for x in input().split()]
S = list(input())
for i in range(len(S)):
  if i == A:
    if S[i] != "-":
      print("No")
      exit()
  else:
    if S[i] == "-":
      print("No")
      exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

if not (str.isdecimal(s[:a])):
    print("No")
    sys.exit()
if not s[a] == '-':
    print("No")
    sys.exit()
if not (str.isdecimal(s[-b:])):
    print("No")
    sys.exit()
print("Yes")

Submission status: Accepted

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

ans = True
if '-' in S[:A]:
    ans = False
if '-' != S[A]:
    ans = False
if '-' in S[A + 1:]:
    ans = False

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

Submission status: Accepted

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

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

ans = 'Yes'
for i, s in enumerate(S):
    if i == A:
        if s != '-':
            ans = 'No'
            break
    else:
        if s not in '0123456789':
            ans = 'No'
            break

print(ans)

Submission status: Accepted

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    d = [str(i) for i in range(10)]
    a, b = list(map(int, readline().split()))
    s = str(readline().rstrip().decode('utf-8'))
    for i in range(a + b + 1):
        if i < a or a < i:
            if s[i] not in d:
                print("No")
                exit()
        else:
            if s[i] != "-":
                print("No")
                exit()
    print("Yes")


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

if '-' in s[:a]:
    ans = 'No'
if '-' != s[a]:
    ans = 'No'
if '-' in s[a + 1:]:
    ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = [str(x) for x in input().split("-")]
if len(s) == 2 and 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 = list(input())
if len(s) != a + b + 1:
    print("No")
elif s[a] != "-":
    print("No")
else:
    for i in range(a):
        if not s[i].isdecimal():
            print("No")
            exit()
    for i in range(a + 1, len(s)):
        if not s[i].isdecimal():
            print("No")
            exit()
    print("Yes")

Submission status: Accepted

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

lists = [str(i) for i in range(0, 10)]

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

Submission status: Accepted

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

for i in range(a + b + 1):
    if (i == a and s[i] != '-') or (i != a and s[i] == '-'):
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
if s[a]!='-':print("No")
else:
    import re
    if len(re.sub("\d","",s))!=1:print("No")
    else :print("Yes")

Submission status: Accepted

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

S = str(input())
num = [i  for i in range(10)]
H = '-'
fr = 0
count = 0
if S[A] != H:
    fr += 1
for i in range(len(S)):
    for j in num:
        if i == A:
            pass
        else:
            if S[i] == str(j):
                count += 1
if count == A + B and fr == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if len(S) == A+B+1:
    for i in range(len(S)):
        if i == A:
            if S[i] != '-':
                print('No')
                exit()
        else:
            if S[i] == '-':
                print('No')
                exit()
    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 or len(s[1])!=b:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

if s[a]=="-":
    del s[a]
    try:
        s=int("".join(s))
    except ValueError:
        print("No")
        ans+=1
else:
    ans+=1
    print("No")
    
if ans==0:
    print("Yes")

Submission status: Accepted

Solution code:
a,b=list(map(int,input().split()))
s=input()
def Post(s,a):
    if s.count('-')!=1:
        return False
    for i in range(len(s)):
        if s.index('-')!=a:
            return False
        return True
if Post(s,a)==True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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