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: Wrong Answer

Solution code:
#coding:utf-8
a,b = (int(i) for i in input().split())
s = input()
print(a,b,s[0:a],s[a],s[a+1:])

a = int(a)
b = int(b)

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

Submission status: Wrong Answer

Solution code:
#coding:utf-8

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

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

elif (S[0:A] in "-") or (S[A+1:len(S)] in "-"):
    print "No"

else:
    print "Yes"

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


if len(s) == a+b+1:
    if ans == '-':
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


if len(s) == a+b+1:
    if ans == '-':
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from pprint import pprint as pp
"""
問題文
Atcoder国では、郵便番号は A+B+1 文字からなり、A+1 文字目はハイフン -、それ以外の全ての文字は 0 以上 9 以下の数字です。
文字列 S が与えられるので、Atcoder国の郵便番号の形式を満たすかどうか判定してください。
制約
    1≦A,B≦5
    |S|=A+B+1
    S は 0 以上 9 以下の数字、およびハイフン - からなる
S がAtcoder国の郵便番号の形式を満たすならば Yes 、そうでなければ No を出力せよ。
"""
a,b=map(int, input().split())
s=input()

def check(it):
    if len(it) != a+b+1:
        return False
    for e in it[:a]:
        if '0' <= e <= '9':
            pass
        else:
            return False
    for e in it[b:]:
        if '0' <= e <= '9':
            pass
        else:
            return False
    if it[a] != '-':
        return False
    return True

if check(s):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
A , B = map(int,input().split())
s = input()
l = len(s)
def check(a):
    li = ["0","1","2","3","4","5","6","7","8","9"]
    if li in a:
        return True
    else:
        return False
torf = False
for i in range(A):
    torf = torf and check(s[i])
for i in range(B):
    torf = torf and check(s[i + A])
if torf and l == (A+B+1) and s[A] == "-":
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
N = input()
p = 1
for i in range(a):
    if N[i] == "0" or "1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9":
        p += 1
    else:
        p = 0
        break
if p > 0:
    if N[a] == "-":
        p += 1
    else:
        p = 0
if p > 0:
    for j in range(b):
        if N[j] == "0" or "1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9":
            p += 1
        else:
            p = 0
            break
if p > 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def solve():
    while 1:
        try:
            A, B = list(map(int, input().split(" ")))
            S = list(input())
            if S[A] != "-":
                print("No")
                raise EndLoop

            for a in S[:A]:
                if not 48 <= ord(a) <= 57:
                    print("No")
                    raise EndLoop

            for b in S[B:]:
                if not 48 <= ord(b) <= 57:
                    print("No")
                    raise EndLoop

            print("Yes")
            break

        except:
            break


solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

good = True
for i in range(a):
    if not s[i].isdigit():
        good = False
        break

if good and s[a] == "-":
    for i in range(a+1,b+1):
        if not s[i].isdigit():
            good = False
            break
print("Yes" if good else "No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
N = input()
p = 1
for i in range(a):
    if N[i] == "0" or "1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9":
        p += 1
    else:
        p = 0
        break
if N[a] == "-":
    p += 1
else:
    p = 0
for j in range(b):
    if N[j] == "0" or "1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9":
        p += 1
    else:
        p = 0
        break
if p > 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def slove(a, b, s):
    for i in range(a + b + 1):
        if i == a:
            pass
        else:
            if s[i].isdigit() == False:
                return "No"
    return "Yes"

if __name__ == "__main__":
    ab = input().split()
    a = int(ab[0])
    b = int(ab[1])
    s = list(input())

    print(slove(a, b, s))

Submission status: Wrong Answer

Solution code:
import sys
a, b = map(int, raw_input().split())
s = raw_input()
num = [str(i) for i in xrange(10)]
for i in xrange(a):
    if not s[i] in num:
        print "No"
        sys.exit()

for i in xrange(b):
    if not s[i+a+1] in num:
        print "No"
        sys.exit()

print "Yes"

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Accepted

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

ans = 'No'
p = '\d{' + str(A) + '}-\d{' + str(B) + '}'
if re.match(p, S):
    ans = 'Yes'
print(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.count('-')==1:
    print("Yes")
else:print("No")

Submission status: Accepted

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

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

else:
    print("No")

Submission status: Accepted

Solution code:
import re

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

former = S[0:A]
later = S[(A+1):(A+B+3)]

r_f = re.compile('\d{' + str(A) + '}')
r_l = re.compile('\d{' + str(B) + '}')

if r_f.findall(former) and r_l.findall(later) and S[A] == '-':
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import re


def answer(a: int, b: int, s: str) -> str:
    pattern = fr'\d{{{a}}}-\d{{{b}}}'
    if re.match(pattern, s):
        return 'Yes'
    return 'No'


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


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] != "-":
      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()
s = S.split("-")
ans = "No"
if len(s) == 2 and len(s[0]) == A and len(s[1]) == B:
    t = "".join(s)
    if all([v in "0123456789" for v in t]):
        ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
import re
a,b = input().split()
s = input()
if re.match(r'\d{' + a + '}-\d{' + b + '}', s):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

ans = True

for (i, char) in enumerate(s):
    if i == a:
        if char == '-':
            ans = True
        else:
            ans = False
            break
    else:
        try:
            ans = type(int(char)) is int
        except:
            ans = False
            break

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

Submission status: Accepted

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

Submission status: Accepted

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

num = '0123456789'

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input().rstrip().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:
lst = input().split()
A = int(lst[0])
B = int(lst[1])
s = input()

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

Submission status: Accepted

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

if S.find("-") == S.rfind("-") == A:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

for i in range(a):
	if is_int(s[i]) == True:
		c += 1
for i in range(a+1,a+b):
	if is_int(s[i]) == True:
		c += 1
if s[a] == '-' and c == len(s) - 2:
	print('Yes')
else:
	print('No')

Submission status: Accepted

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

S=input()
d=0
c=a+b+3
for i in range(a+b+1):
	if S[i]=='-':
		c=i+1
		d+=1

if c==a+1 and d==1:
	print('Yes')
else:
	print('No')

Submission status: Accepted

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

if S[A] == "-" and all( t in D for t in T):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(A: int, B: int, S: str):
    if len(S) != A + B + 1:
        print(NO)
        return
    an = S[0:A]
    h = S[A]
    bn = S[A+1:]
    if not an.isdecimal():
        print(NO)
        return
    if h != "-":
        print(NO)
        return
    if not bn.isdecimal():
        print(NO)
        return
    print(YES)

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(A, B, S)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if len(s) == a + b + 1:
	if s[a] == "-":
		del s[a]
		try:
			if all([0 <= int(x) <= 9 for x in s]):
				print("Yes")
			else:
				print("No")
		except:
			print("No")
	else:
		print("No")
else:
	print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

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

x = s.split("-")

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
if len(s) != a+b+1:
    print('No')
    exit()
else:
    if s[a] != '-':
        print('No')
        exit()
    else:
        for i in range(0,a):
            if s[i] == '-':
                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:
import math

is_no = 0
num1, num2 = map(int, input().split())
str1 = input()
table = list(str1)
count = 0
for i in range(len(str1)):
    if table[i] == '-':
        count += 1
    else:
        continue
if count == 1 and table[num1] =='-':
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

if "-" in s[:a] or "-" in s[-b:] or s[a]!="-":
    print("No")
else:
    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")
      break
  else:
    try:
      Si = int(S[i])
    except:
      print("No")
      break
else:
  print("Yes")

Submission status: Accepted

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

result = 'Yes'
if '-' in S[:A]:
    result = 'No'
if '-' not in S[A]:
    result = 'No'
if '-' in S[A+1:]:
    result = 'No'

print(result)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import re
A, B = map(int, input().split())
S = input()
pattern = re.compile('[0-9]'*A + '-' +'[0-9]'*B)
print('Yes' if pattern.fullmatch(S) != None else 'No')

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 = str(input())
#print(s[a+1])

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()
ans = 'Yes'
for i in range(len(s)):
    if i > a + b:
        ans = 'No'
        break
    if i == a:
        if s[i] != '-':
            ans = 'No'
            break
    elif not s[i].isdigit(): 
        ans = 'No'
        break
print(ans)

Submission status: Accepted

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

ans = 'Yes'
if S[A] != '-':
    ans = 'No'
else:
    S = S.replace('-', '', 1)
    if S.isdecimal() == False:
        ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
import sys
A, B = [int(x) for x in input().split()]
S = list(input())
for i in range(A+B+1):
  if(i==A):
    if(S[i]!='-'):
      print('No')
      sys.exit()
  else:
    if(str.isdecimal(S[i])==False):
      print('No')
      sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
s = input()
for i in s[0:a]:
    if 48 <= ord(i) and ord(i) <= 57:
        continue
    else:
        print("No")
        exit()
if s[a] != "-":
    print("No")
    exit()
for i in s[a+1:a+b+1]:
    if 48 <= ord(i) and ord(i) <= 57:
        continue
    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()

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import copy
import math
import itertools
import numpy as np

l = [int(c) for c in input().split()]
A=l[0]
B=l[1]
S=input()

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

Submission status: Accepted

Solution code:
import sys


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


A, B = LI()
S = input()
ans = "Yes"
for i in range(A):
    if S[i] == "-":
        ans = "No"
        break
if S[A] != "-":
    ans = "No"
for i in range(A+1, A+B+1):
    if S[i] == "-":
        ans = "No"
        break
print(ans)

Submission status: Accepted

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

if len(s.split('-')) == 2 and s[a] == '-':
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


A,B = MI()
S = LS2()

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

def is_num(x):
    if '0' <= x <= '9':
        return True
    return False
def err():
    print('No')
    quit()

a,b = inpl()
s = input()
for i,x in enumerate(s):
    if i == a:
        if x != '-':
            err()
    else:
        if not is_num(x):
            err()
print('Yes')

Submission status: Accepted

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

okFlag = True
for key,val in enumerate(S):
    if key == A:
        if S[key] != '-':
            okFlag = False
        else:
            continue
    elif S[key] not in check:
        okFlag = False

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = input().strip()
Num = [str(i) for i in range(10)]
if S[A]=="-":
    flag = 0
    for i in range(A+B+1):
        if i!=A and S[i] not in Num:
            flag = 1
            break
    if flag==0:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = str(input())
for i in range(len(S)):
  if i < A:
    if not S[i].isnumeric():
      print("No")
      exit()
  elif i == A:
    if S[i] != "-":
      print("No")
      exit()
  else:
    if not S[i].isnumeric():
      print("No")
      exit()
print("Yes")

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


A,B = MI()
S = LS2()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
X = {str(i) for i in range(0, 10)}
f = 0
for i in range(A+B+1):
  if i != A and S[i] not in X:
    f = 1
    break
  if i == A and S[i] != "-":
    f = 1
    break
if f == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
a, b = list(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:
def main():
    a, b = map(int, input().split())
    s = input()
    all_l = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    hyphen = ['-']

    answer = 'Yes'
    for i in range(len(s)):
        if i == a:
            if s[i] not in hyphen:
                answer = 'No'
        else:
            if s[i] not in all_l:
                answer = 'No'

    print(answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

check = False
if len(S) == 2:
  s,t = S[0],S[1]
  if A == len(s) and B == len(t):
    check = True

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

Submission status: Accepted

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

A = s[:a]
con = s[a]
B = s[-b:]

flg = True
num = [str(x) for x in range(10)]
num = set(num)

for x in A:
    if x not in num:
        flg = False

for x in B:
    if x not in num:
        flg = False

if con != "-":
    flg = False

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

Submission status: Accepted

Solution code:
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

import string

for v in S[:A]:
    if v not in string.digits:
        print('No')
        sys.exit(0)
if S[A] != '-':
    print('No')
    sys.exit(0)
for v in S[A+1:]:
    if v not in string.digits:
        print('No')
        sys.exit(0)
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
A, B = map(int, input().split())
S = input()
n_pattern = "[0-9]"
res  = "Yes"
for i in range(A+B+1):
  if i < A:
    if re.match(n_pattern, S[i]) is None:
      res = "No"
      break
  elif i == A:
    if S[i] != "-":
      res = "No"
      break
  else:
    if re.match(n_pattern, S[i]) is None:
      res = "No"
      break
  
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

    for i in range(a + b + 1):
        if i == a:
            if s[i] != "-":
                print("No")
                exit()
        else:
            if not "0" <= s[i] <= "9":
                print("No")
                exit()
    else:
        print("Yes")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import copy
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

if len(s) == 2 and len(s[0]) == a and len(s[1]) == b:
    print('Yes')
    sys.exit()
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 = list(map(int,input().split()))
s =input()
for i in range(a+b+1):
    if i == a:
        if s[i] !='-':
            print('No')
            break
    else:
        if s[i]=='-':
            print("No")
            break
            
        else:
            if int(s[i])<0 or 9<int(s[i]):
                print("No")
                break
else:
    print('Yes')

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
n = input()
if n[0:a].isdecimal() and n[a]=="-" and n[a+1:a+b+1].isdecimal():
  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] == '-':
        print('No')
        exit(0)
    elif i == A and S[i] != '-':
        print('No')
        exit(0)
    elif i > A and S[i] == '-':
        print('No')
        exit(0)
print('Yes')

Submission status: Accepted

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

flag = False
if S[A] == '-':
    S_ = S.split('-')
    if len(S_) == 2:
        if len(S_[0]) == A and len(S_[1]) == B:
            if S_[0].isdigit() and S_[1].isdigit():
                flag = True

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

Submission status: Accepted

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

Submission status: Accepted

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

num = list(map(str,list(range(10))))

flag = True
for i in range(a):
    if s[i] not in num:
        flag = False
if s[a] != "-":
    flag = False
for i in range(a+1,a+b+1):
    if s[i] not in num:
        flag = False

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

Submission status: Accepted

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