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:
import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
A,B = LI()
S = S()
ans = 1
for i in range(A+B+1):
    if i==A:
        if S[i]!='-':
            ans = 0
            break
    else:
        if not S[i] in '1234567890':
            ans = 0
            break
print(['No','Yes'][ans])

Submission status: Accepted

Solution code:
import re,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
A,B = LI()
S = S()
print('Yes' if re.fullmatch(pattern=r'\d{{{}}}-\d{{{}}}'.format(A,B),string=S) else '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:
    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.count("-")== 1 else "No")

Submission status: Accepted

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

if S.pop(A)=="-":
    for i in S:
        if i not in str([0,1,2,3,4,5,6,7,8,9]):
            break
    else:
        ans = "Yes"

print(ans)

Submission status: Accepted

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

flag = True
if len(s) != 2:
    flag = False
if flag:
    if len(s[0]) != a:
        flag = False
    if len(s[1]) != b:
        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]=="-" and s.replace("-","0",1).isdigit() else "No")

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = list(input())
flag = 1
a = "".join(S[:A])
b = "".join(S[A+1:])
if not(str.isdecimal(a)):
  flag = 0
if S[A] != "-":
  flag = 0
if not(str.isdecimal(b)):
  flag = 0
if flag == 1:
  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:].isdigit():
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
A,B=map(int, input().split())
S=list(str(input()))
s1=''
s2=''
for i in range(A):
    if S[0] in ['1','2','3','4','5','6','7','8','9','0']:
        s1+=S.pop(0)
    else:
        print('No')
        exit()
t=S.pop(0)
if t!='-':
    print('No')
    exit()
for i in range(B):
    if S[0] in ['1','2','3','4','5','6','7','8','9','0']:
        s2+=S.pop(0)
    else:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
import collections

#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
    s = list(input())
    return s

#整数を一つずつリストに入れる
def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a

def main():
    a,b = input().split()
    s = input()
    if s.count("-") == 1:
        c,d = s.split("-")
        if a == str(len(c)) and b == str(len(d)):
            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()
L=list(S)
l=L.count('-')
if l==1:
  SS,T=S.split('-')
  if len(str(SS))==A and len(str(T))==B:
    print('Yes')
  else:
    print('No')
    
else:
  print('No')

Submission status: Accepted

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

c = 0

for i in s:
    if i == '-':
        c += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

index = n.find("-")

if n.count("-") == 1 and index == a:
	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()
f = False
if s[a] == '-':
    f = True

for i in range(len(s)):
    if s[i] == '-' and i != a:
        f = False

if f:
    print('Yes')

else:
    print('No')

Submission status: Accepted

Solution code:
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0

a,b = map(int,input().split())
s = input()
for x in range(len(s)):
    if s[x] == '-':
        neko = x
        nya+=1
if nya != 1:
    pn()
elif (a == neko)and(b == len(s)-1-neko):
    py()
else:
    pn()

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

Submission status: Accepted

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

Submission status: Accepted

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

print("Yes") if (S.find("-")==A) & (S.count("-")==1) else print("No")

Submission status: Accepted

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

for i, c in enumerate(S):
    if not ((i == A and c == '-') or (i != A and c in '0123456789')):
        flg = False

print('Yes' if flg else 'No')

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=list(input())
if s.count('-')==1 and len(s)==a+b+1 and s[a]=='-':
    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.replace("-","0",1).isdecimal() else "No")

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

ans = True
for i in range(len(S)):
    if i == A:
        if S[i] != "-":
            ans = False
    else:
        if not (48 <= ord(S[i]) <= 57):
            ans = False

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if 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()
x='0123456789'
ans='Yes'
for i in range(a):
  if s[i] not in x:
    ans='No'
if s[a]!='-':
  ans='No'
for i in range(b):
  if s[a+i+1] not in x:
    ans='No'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from fractions import gcd
def resolve():
    A,B=pin()
    S=input()
    for i in range(A+B+1):
        if i==A:
            if S[i]!="-":
                print("No")
                return
        else:
            if S[i]=="-":
                print("No")
                return
    print("Yes")
        
#%%submit!    
resolve()

Submission status: Accepted

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

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


resolve()

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 = list(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 = list(map(int,input().split()))
C = input()
for i in range(A):
    if C[i] !="-":
        pass
    else:
        print("No")
        exit()
if C[A] == "-":
    pass
else:
    print("No")
    exit()
for i in range(A+1,A+B+1):
    if C[i] !="-":
        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 = input()

S1 = S[:A]
S2 = S[A]
S3 = S[A+1:]

print("Yes" if S1.isdecimal() and S2 =="-" and S3.isdecimal() else "No")

Submission status: Accepted

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

flg = True
skip = A
cnt=0

if len(S) != A+B+1:
    flg=False
    

for i in range(len(S)):
    
    if cnt == A:
        if S[cnt]!= "-":
            flg = False
    else:
        if S[cnt] == "-":
            flg = False

    cnt+=1
    
if flg ==True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a,b  = map(int, input().split())
nums = list("1234567890")
S = input()
for i,s in enumerate(S):
    if i == a and s != "-":
        print("No")
        exit()
    elif i != a and s not in nums:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
import re

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

Submission status: Accepted

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

if len(s) == a + b + 1 and s[a] == '-' and len([c for c in s if c == "-"]) == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if str.isdecimal(S[0:A]) and S[A]=="-" and str.isdecimal(S[A+1:]):
    #print(str.isdecimal(S[0:A]))
    #print(S[A]=="-")
    #print(str.isdecimal(S[A+1:]))
    #print(S[A+2:])
    
    print("Yes")
else:
    #print(str.isdecimal(S[0:A]))
    #print(S[A])
    #print(str.isdecimal(S[A+1:]))
    #print(S[A+1:])
    
    print("No")

Submission status: Accepted

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

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

elif S.count('-') != 1:
    print("No")

else:
    print("Yes")

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:
A,B=map(int,input().split())
S=input()
num=[str(k) for k in range(10)]

for i in range(A):
  if S[i] not in num:
    print('No')
    exit()
    
if S[A]!='-':
  print('No')
  exit()
  
for j in range(A+1,A+B):
  if S[j] not in num:
    print('No')
    exit()
    
print('Yes')

Submission status: Accepted

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

match = True
for i in range(A+B+1):
    if i == A:
        if S[i] != "-":
            print("No")
            match = False
            break
    else:
        if S[i] not in ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]:
            print("No")
            match = False
            break
            
if match:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

flag = True
if not(len(S) == A+B+1):
    flag = False
if not(S[A] == '-'):
    flag = False
for i in range(A+B+1):
    if i != A:
        if not(48<=ord(S[i])<=57):
            flag = False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
s = input()
N = set(['1','2','3','4','5','6','7','8','9','0'])
i = 0
ans = 'Yes'
while i < a:
  if not s[i] in N:
    ans = 'No'
  i += 1

if not s[i] == '-':
  ans = 'No'
i += 1

while i < a+b+1:
  if not s[i] in N:
    ans = 'No'
  i += 1
print(ans)

Submission status: Accepted

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

s = list(input())[::-1]

for _ in [0]*a:
  if not s.pop().isdigit():
    print("No")
    exit()
if s.pop() != '-':
    print("No")
    exit()

for _ in [0]*b:
  if not s.pop().isdigit():
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
A, B = ri_()
S = rs()
f = 0
if len(S) == A + B + 1 and S[A] == '-' and all([i in digits for i in S[:A]+S[A+1:]]):
    f = 1
print('Yes' if f else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

numbers = set([str(i) for i in range(10)])
flag = 0
for s in S[:a]:
  if not s in numbers:
    flag = -1

if S[a] != "-":
  flag = -1

for s in S[a+1:]:
  if not s in numbers:
    flag = -1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
stg = input()
res = "Yes"
for i in range(a):
  if not stg[i].isdigit():
    res = "No"
if not stg[a]=='-':
  res = "No"
for i in range(a+1,a+b+1):
  if not stg[i].isdigit():
    res = "No"
print(res)

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()
length=A+B+1

ans=False
cnt=0
for i in range(length):
  if S[i]=="-":
    cnt+=1
  if i == A and S[i] == "-":
    ans=True
print('Yes' if ans==True and cnt==1 else 'No')

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=input()
res=0
if S[0:A].isdecimal() is False:
	res=1
if S[A] !='-':
	res=1
if S[A+1:].isdecimal() is False:
	res=1
if res==1:
	print('No')
else:
	print('Yes')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

a,b=MI()
s=input().rstrip()
s=list(s)
count=0
lis=[str(i) for i in range(10)]
if len(s)!=a+b+1:
    print("No")
    #print(1)
    sys.exit()
if s[a]!="-":
    #print(2)
    print("No")
    sys.exit()
for i in range(a):
    if not(s[i] in lis):
        #print(3)
        print("No")
        sys.exit()
for i in range(a+1,a+b+1):
    if not(s[i] in lis):
        #print(4)
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
a, b=map(int, 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 = map(int, input().split())
s_list = list(input())
flag = True

if s_list[a] == "-":
    s_list.pop(a)
    for digit in s_list:
        if digit == "-":
            flag = False
            break
else:
    flag = False

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = list(input())
a = ''.join(S[0:A])
b = ''.join(S[A+1:A+2+B])
c = S[A]
if str.isdecimal(a) and str.isdecimal(b) and c == '-':
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
s = input()
num = '0123456789'
flg = 0
for i in range(len(s)):
  if i < n-1:
    if s[i] not in num:
      flg = 1
  elif i == n:
    if s[i] != '-':
      flg = 1
  else:
    if s[i] not in num:
      flg = 1
if flg == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import sys, string
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    A, B = LI()
    Str = S()

    is_ok = True
    for i, e in enumerate(Str):
        if i==A:
            if e!='-':
                is_ok = False
        else:
            if not e in string.digits:
                is_ok = False
    
    if is_ok:
        print('Yes')
    else:
        print('No')

    
if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
keep=0
for i in range(0,a):
  if not 48<=ord(s[i])<=57:
    keep=1
    break
if not s[a]=="-":
  keep=1
for j in range(a+1,a+b+1):
  if not 48<=ord(s[j])<=57:
    keep=1
    break
print(["No","Yes"][keep==0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
N = list(input())
num = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']

for i in range(len(N)+1):
    if i == len(N):
        print('Yes')
    elif i == A:
        if N[i] == '-':
            continue
        else:
            print('No')
            break
    else:
        if N[i] in num:
            continue
        else:
            print('No')
            break

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
for i, c in enumerate(s):
    if i==a:
        if c!='-':
            print('No')
            break
    else:
        if c=='-':
            print('No')
            break
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
number=[str(i) for i in range(10)]
S=input()

for i in range(A):
    if not S[i] in number:
        print("No")
        exit()

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

for i in range(A+1,A+B+1):
    if not S[i] in number:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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

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 s.count("-") == 1:
    if s[a] == "-":
        if len(s) == a + b + 1:
            print("Yes")
            exit()

print("No")

Submission status: Accepted

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

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

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

for j in range(A+1,A+B+1):
    if S[j]=='-':
        ans='No'

print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
c = [str(i) for i in range(10)]
ans = True
for i in range(len(S)):
  if i == A and S[i] != '-':
    ans = False
  if i != A and S[i] not in c:
    ans = False
if ans:
  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 = str(input())

if S.isdecimal():
    print("No")
else:
    s = list(map(str, S))
    del s[A]

    count = s.count("-")

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

Submission status: Accepted

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

Submission status: Accepted

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

length = A + B + 1
index_of_hyphen = A
ans = 'No'

if len(S) == length and S.pop(index_of_hyphen) == '-':
    ans = 'Yes'
    for s in S:
        if s == '-':
            ans = 'No'
            break

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = input()
sw = 0
for i in range(len(s)):
    if i == a and s[i] != '-':
        sw = 1
    elif i != a and s[i] == '-':
        sw = 1
    else:
        pass
if sw == 1:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import re
A, B = map(str,input().split())
S = input()
pattern = r'[0-9]{'+A+'}-[0-9]{'+B+'}'
matchObj = re.match(pattern, S)
if matchObj:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

# print(S[:A], S[A], S[A+1:])

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()
mae=s[0:a]
ushiro=s[a+1:]
if mae.isdigit() and ushiro.isdigit() and s[a]=='-':
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B=list(map(int,input().split()))
S=input()
for i in range(0,A):
    if S[i]!='0'and S[i]!='1'and S[i]!='2'and S[i]!='3'and S[i]!='4'and S[i]!='5'and S[i]!='6'and S[i]!='7'and S[i]!='8'and S[i]!='9':
        print('No')
        exit()
if S[A]!='-':
    print('No')
    exit()
for i in range(A+1,A+B+1):
    if S[i]!='0'and S[i]!='1'and S[i]!='2'and S[i]!='3'and S[i]!='4'and S[i]!='5'and S[i]!='6'and S[i]!='7'and S[i]!='8'and S[i]!='9':
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
import numpy as np
import sys

input = sys.stdin.readline

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

S = input()


res = True
if S.count('-') != 1:
    res = False
else:
    x,y = S.split('-')
    y = y[:-1]
    if len(x) != A or len(y) != B:
        res = False
    else:
        res = (x.isdecimal() and y.isdecimal())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
# ABC084B

a, b = map(int, input().split())
s = input()
ans = 'Yes'
if s[a] != '-':
    ans = 'No'
else:
    for i, c in enumerate(s):
        if (c < '0' or c > '9') and i != a:
            ans = 'No'
            break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    a, b = map(int, input().split())
    s = input()

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