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()
y = s.split("-")

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from itertools import product, permutations, combinations
from bisect import bisect_right,bisect_left

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
print("YNeos"[not(len(S)==A+B+1 and S[A]=="-" and all(s.isdigit() for i,s in enumerate(S) if i != A))::2])

Submission status: Accepted

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

s1,s2 = s.split('-')
if a == len(s1) and b == len(s2):
  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].isdecimal() and s[b+1:].isdecimal() else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    if s[a] != '-':
        print('No')
        exit()
    
    slist = list(s)
    slist[a] = ''

    if ''.join(slist).isdigit():
        print('Yes')
        exit()

    print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
a,b=map(int,input().split())
S=[i for i in input()]
l=[]

#print(S[a])
cnt=0
if S[a]=='-':
    del S[a]
    for u in S:
        if u=='-':
            print('No')
            break
        else:
            cnt+=1
            if cnt==len(S):
                print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input().split('-')
if len(S) > 1:
    former, latter = S[0], S[1]
else:
    former = latter = []

if len(former) == A and len(latter) == 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())

c = s.pop(a)
if (c != '-'):
   print('No')
   exit()

try:
   check = [int(x) for x in s]
except:
   print('No')
   exit()
print('Yes')

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
for i in s:
    s0 = s[0:a]
    s1 = s[a+1:]

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

Submission status: Accepted

Solution code:
A,B = [int(i) for i in input().split()]
S = input()
Sa = S[:A]
Sb = S[A+1:]
def hoge(S) :
    if S[A] == "-" :
        return True
    else :
        return False
if Sa.isdecimal() and hoge(S) and Sb.isdecimal() :
    print("Yes")
else :
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
import re

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

reg = "\d{{{}}}-\d{{{}}}".format(A, B)
m = re.fullmatch(reg, S)
if m:
    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 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()

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

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
  a, b = map(int, input().split())
  s = input()
  for i in range(len(s)):
    if i == a:
      if s[i] != '-':
       	return False
    else:
      if s[i] == '-':
        return False
  return True
 
if __name__ == '__main__':
  if main():
    print('Yes')
  else:
    print('No')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
a,b=map(int,input().split())
s=input().strip()
flg=True
for i in range(a):
    if s[i]=="-":
        flg=False
if s[a]!="-":
    flg=False
for i in range(b):
    if s[a+i+1]=="-":
        flg=False
print("Yes" if flg else "No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
A, B = [int(x) for x in input().split()]
S = input().rstrip()
if S[A] != "-":
    print("No")
    sys.exit()
if "-" in S[:A] or "-" in S[A+1:]:
    print("No")
    sys.exit()
print("Yes")

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(a: int, b: int, s: str):
    try:
        _a, _b = s.split('-')

        if a != len(_a) and b != len(_b):
            print('No')
        else:
            print('Yes')
    except ValueError:
        print('No')


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

    main(a, b, s)

Submission status: Accepted

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

print('Yes' if flag == True else 'No')

Submission status: Accepted

Solution code:
# -coding: utf-8 -

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

isNo = False
if s[a] != "-":
    isNo = True
else:
    try:
        int(s[:a])
    except:
        isNo = True

    try:
        int(s[a+1:])
    except:
        isNo = True

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#N = int(input())
A, B = map(int, input().split())
S = str(input())

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

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

try:
  d1 = int(S[0:A])
  d2 = int(S[A+1:])
except:
  print ("No")
  exit()

if d1 < 0 or d2 < 0 :
  print ("No")
  exit()
    
print ("Yes")

Submission status: Accepted

Solution code:
import re
A,B=map(int,input().split())
S=input()
a,b,flg=S[0:A],S[-B:],True
if S[A]!="-" or re.match(".*[^0-9].*",a) or re.match(".*[^0-9].*",b):flg=False
print("Yes" if flg else "No")

Submission status: Accepted

Solution code:

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

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

else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

if s.count('-')==1 and s[a]=='-':
    for i in range(a):
        if int(s[i]) in range(0, 10):
            cnt += 1
    if s[a]=='-':
        cnt += 1
    for i in range(b):
        if int(s[a+1+i]) in range(0, 10):
            cnt += 1

    if cnt == a+b+1:
        print('Yes')
    else:
        print('No')

else:
    print('No')

Submission status: Accepted

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

ans = "Yes" if s.count("-") == 1 and s.find("-") == a else "No"
print(ans)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
x=0
if s[a]=='-':
    for i in range(10):
        x+=s.count(str(i))
    if x==len(s)-1:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys

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

str_len = len(S)

for i in range(str_len):

    a = S[i]
    if i==A:
        if a=="-":
            continue
        else:
            print("No")
            sys.exit()
    if str.isdecimal(a)==False:
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
num=[str(i) for i in range(10)]
for i in range(a):
    if not(s[i] in num):
        print("No")
        exit()
if s[a]!="-":
    print("No")
    exit()
for i in range(a+1,a+b+1):
    if not(s[i] in num):
        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]=="-" and s.count("-")==1:
  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()

f=True
for i in range(len(s)):
	if i==a:
		if s[i]!='-':
			f=False
			break
	else:
		if s[i] not in '0123456789':
			f=False
			break

if len(s)!=a+b+1:
	f=False

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

Submission status: Accepted

Solution code:
import sys

a, b = map(int, sys.stdin.readline().split())
s = sys.stdin.readline().rstrip()

def main():
    return 'Yes' if s[a] == '-' and not '-' in set(s[:a] + s[a+1:]) else 'No'

if __name__ == '__main__':
    ans = main()
    print(ans)

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

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

Submission status: Accepted

Solution code:
import sys
a, b = map(int, sys.stdin.readline().split())
s = input()

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

Submission status: Accepted

Solution code:
l=[str(i) for i in range(10)]
n,m=map(int,input().split())
w=input()
for i in range(n):
  if w[i] in l:
    pass
  else:
    print("No")
    exit()
if w[n]!="-":
  print("No")
  exit()
for i in range(m):
  if w[i+1+n] in l:
    pass
  else:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
a,b=map(int,input().split())
print(re.fullmatch(r"[0-9]{%d}-[0-9]{%d}" %(a,b), input()) and "Yes" or "No")

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
s= input()
Answer = 'No'
if s[:A].isdecimal()==True:
  if s[A+1:A+B+1].isdecimal()==True:
    if s[A]=='-':
      Answer = 'Yes'

print(Answer)

Submission status: Accepted

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

S =  input()


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

print(ans)

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    il = [str(i) for i in range(0, 10)]
    a, b = list(map(int, input().rstrip('\n').split()))
    s = str(input().rstrip('\n'))
    for i, v in enumerate(s):
        if i < a or a < i < a + b + 1:
            if v not in il:
                print("No")
                exit()
        elif i == a:
            if v != "-":
                print("No")
                exit()
    print("Yes")


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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 ('0' <= s[i] and s[i] <= '9'):
            print('No')
            exit()
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

num1=x[0:a]
hi=x[a]
num2=x[a+1:]
if num1.isdecimal()==True and num2.isdecimal()==True and hi=="-":
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import re
a, b = map(int, input().split())
s = input()
#a文字目までとハイフン以降b文字目までで分ける
s_a = s[0:a]
s_b = s[a+1:]
#print(s_a, s_b)
#正規表現でs_aとs_bがすべて数字ならOK(数字でない場合はNone)
if s[a] == '-' and re.fullmatch(r'[0-9]+', s_a) != None and re.fullmatch(r'[0-9]+', s_b):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
c = input()
if c[a] == "-" and all(i!="-" for i in c[:a]) and all(j!="-" for j in c[a+1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = list(input())
ans = "No"
if not "-" in s[0:a] and s[a] == "-" and not "-"  in s[a+1:]:
  ans = "Yes"
# for i in range(len(s)):
#   if i == a and s[i] == "-":
#     ans = "Yes"
#   elif i != a and s[i] == "-":
#     ans = "No"
print(ans)

Submission status: Accepted

Solution code:
r=lambda:map(int,input().split())
import sys
a,b=r()
s=input()
if s[a]!='-':
  print("No")
  sys.exit(0)

d='0123456789'
for i in range(len(s)):
  if i==a: continue
  if s[i] not in d:
    print("No")
    sys.exit(0)
    
print("Yes")

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations
import sys
import bisect
import string
import math
import time
from fractions import gcd
#import random


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations
import sys
import bisect
import string
import math
import time
from fractions import gcd
#import random


def I(): return int(input())


def MI(): return map(int, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['Yes', 'No']
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)


show_flg = False
# show_flg = True


def main():
    A, B = MI()
    S = input()

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

    for i in range(len(S)):
        if i == A and S[i] != '-':
            print('No')
            # print('2')
            return
        elif i != A and S[i] not in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
            print('No')
            # print('3', i, S[i])
            return

    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if a == len(ls_s[0]) and b == len(ls_s[1]):
    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[-b:]

if s2 != '-':
    print('No')
    quit()
try:
    i1 = int(s1)
    i2 = int(s3)
except:
    print('No')
    quit()
print('Yes')

Submission status: Accepted

Solution code:
import sys
a,b=input().split()
a,b=int(a),int(b)
s=input().rstrip()
if len(s)!=a+b+1:
    print("No")
    sys.exit()
elif s[a]!="-":
    print("No")
    sys.exit()
k=0
list=["0","1","2","3","4","5","6","7","8","9"]
while k<a:
    if s[k] in list:
        pass
    else:
        print("No")
        sys.exit()
    k+=1
k+=1
while k<=a+b:
    if s[k] in list:
        pass
    else:
        print("No")
        sys.exit()
    k+=1
print("Yes")

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")
            exit()
    else:
        if S[i] == "-":
            print("No")
            exit()
            
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
AB = list(map(int,input().split()))
A=AB[0]
B=AB[1]
S=input()

if re.fullmatch(r'\d{'+str(A)+'}-\d{'+str(B)+'}',S) == None:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

s = input()

ans = 0

if s[a]=='-':
	for i in range(a):
		#print(s[i])
		if s[i]== '-':
			ans = ans + 1
			#print('check'+s[i])
	for j in range(b):
		#print(s[a+j+1])
		if s[a+j+1]=='-':
			ans = ans + 1
			#print('check'+s[a+j])
else:
	ans = ans + 1
	
print('Yes' if ans==0 else 'No')

Submission status: Accepted

Solution code:
#Postal Code
A, B = map(int,input().split())
S = input()
num = [chr(ord('0') + i) for i in range(10)]
judge = 1

for i in range(len(S)):
    if i == A:
        if S[i] == "-":
            pass
        else:
            judge = 0
    else:
        if S[i] in num:
            pass
        else:
            judge = 0
            
if judge == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if S.count("-") == 0 or S.count("-") >= 2:
  print("No")
else:
  if not S[A] == "-":
    print("No")
  else:
    tmp = S.split("-")
    if len(tmp[0]) >= 1 and len(tmp[1]) >= 1:
      print("Yes")
    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)]

if len(s) != a+b+1:
    print("No")
    import sys
    sys.exit()
for ss in s[:a]+s[a+1:]:
    if ss not in num:
        print("No")
        import sys
        sys.exit()

if s[a] != "-":
    print("No")
    import sys
    sys.exit()

print("Yes")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

A,B=many_int()

S=one_str()

flg=False
if S[A]=="-":
    temp = S[:A-1] + S[A+1:]
    if temp.isdecimal() and len(S) == A+B+1:
        flg=True

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A,B = (int(i) for i in input().split())
S = str(input())
if S[A] != "-" or "-" in S[:A] or "-" in S[-B:]:
    print('No')

else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
##### 解けた #####

A,B=list(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:
import sys
a,b=map(int,input().split())
s=input()
for i in range(a):
    if s[i]=='-':
        print('No')
        sys.exit()
if  s[a]!='-':
    print('No')
    sys.exit()
for i in range(b):
    if s[i+a+1]=='-':
        print('No')
        sys.exit()
print('Yes')

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 = list(map(int, input().split()))
S = input()
ans = S[A]=='-'
for c in S[:A  ]: ans = ans and (c in '0123456789')
for c in S[A+1:]: ans = ans and (c in '0123456789')
print('Yes' if ans else 'No')

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    A,B = MI()
    S=ST()
    for i,s in enumerate(S):
        ok = True
        if i < A:
            if s=="-":
                ok = False
        elif i==A:
            if s!="-":
                ok = False
        else:
            if s=="-":
                ok = False
        if not ok:
            print("No")
            exit()
    print("Yes")
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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


main()

Submission status: Accepted

Solution code:
def judge(S,A,B):
  a = list(S)
  front = a[0:A]
  back = a[A+1:A+B+1]
  lst = ["0","1","2","3","4","5","6","7","8","9"]
  for i in range(A):
    if front[i] not in lst:
      print("No")
      return
            
  for j in range(B):
    if back[j] not in lst:
      print("No")
      return
            
  if a[A]!="-":
    print("No")
    return
  
  print("Yes")
  
A,B = map(int,input().split())
S = input()
judge(S,A,B)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
n=input()
if n[0:a].isdecimal()==True and n[a+1:b+a+1].isdecimal()==True and n[a]=="-":
  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:
    ans = "Yes"
else:
    ans = "No"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

first = s[:a]
hyphen = s[a]
second = s[a+1:]

if len(second) == b and hyphen == "-":
  try:
    int(first)
    int(second)
    print("Yes")
  except:
    print("No")
    
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:
#84b
A,B = map(int, input().split())
S = str(input())

if S[A]!="-":
    print("No")
else:
    for i in range(len(S)):
        if (i<A or i>A) and S[i].isdecimal()!=True:
            print("No")
            break
    else:
        print("Yes")

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:
from sys import stdin
from itertools import combinations
from math import factorial
import numpy as np
import math

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

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