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, raw_input().split())
s = raw_input()
def f(s,a):
	for i,l in enumerate(s):
		if i != a and l not in map(str, range(10)): return False
	return True
print 'Yes' if s[a] == '-' and f(s,a) else '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()
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 str.isdecimal(S[:A]+S[-B:]):
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
import re

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

m = re.match("([0-9]+)-([0-9]+)", S)

if m:
    t1 = m[1]
    t2 = m[2]
    if len(t1) == A and t1.isdecimal() and len(t2) == B and t2.isdecimal():
        print("Yes")
        exit()

print("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 and s[i] == '-':
    print('No')
    sys.exit()
  elif i == a and s[i] != '-':
    print('No')
    sys.exit()
  elif i > a + 1 and s[i] == '-':
    print('No')
    sys.exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
f=1
a,b=list(map(int,input().split()))
s=input()
if s[a]!="-":
  f=0

for i in range(a):
  if not s[i] in "1234567890":
    f=0
for i in range(b):
  if not s[i+a+1] in "1234567890":
    f=0
if f:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
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
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
import numpy as np
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()

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

Submission status: Accepted

Solution code:
import re

A, B = map(int, input().split())
S = input()
print ('Yes' if re.search(r'\A\d{{{}}}-\d{{{}}}\Z'.format(A, B), S) else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
if s.count('-')!=1:
	r='No'
else:
	t,u=s.split('-')
	if len(t)==a and len(u)==b and (t+u).isdecimal():
		r='Yes'
	else:
		r='No'
print(r)

Submission status: Accepted

Solution code:
def func(s, n):
    for i in range(10):
        if s[n] == str(i):
            return True
    return False
  
  
a, b = map(int,input().split())
s = input()

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

for i in range(a+b+1):
    if i == a:
        if s[i] != '-':
            flg = False
    else:
        flg = func(s, i)
    if not flg:
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

A, B = [int(x) for x in input().split()]
S = input()
print ('Yes' if re.search(r'\A\d{{{}}}-\d{{{}}}\Z'.format(A, B), S) else 'No')

Submission status: Accepted

Solution code:
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:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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:
dic = ["0","1","2","3","4","5","6","7","8","9"]

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

ok = True
for i in range(A):
    if not(S[i] in dic):
        ok=False

if S[A]!="-":
    ok=False

for i in range(A+1,A+B+1,1):
    if not(S[i] in dic):
        ok =False

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def resolve():
    a, b = map(int, input().split())
    s = input()
    
    flag_len = False
    flag_bar = False
    flag_num = True
    if a+b+1 == len(s):
        flag_len = True
    if s.count("-") == 1 and s[a] == "-":
        flag_bar = True
    if flag_len and flag_bar:
        for i in range(len(s)):
            code = ord(s[i])
            if code < ord("0") or ord("9") < code:
                if code!= ord("-"):
                    flag_num == False
                    break
                
    if flag_len and flag_bar and flag_num:
        print("Yes")
    else:
        print("No")
resolve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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 = list(input())

if s[a] != "-":
    result = "No"
elif len([x for x in s if x in [str(x) for x in range(10)]]) + 1 == len(s):
    result = "Yes"
else:
    result = "No"
print(result)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
NUMS = "0123456789"
flg = True
for i in range(A):
  flg *= (S[i] in NUMS)
flg *= (S[A] == '-')
for i in range(A, A+B):
  flg *= (S[i+1] in NUMS)
if flg:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    a,b = map(int,input().split())
    s = input().rstrip()
    if len(s)==a+b+1:
        if s[a]=="-" and s.count("-")==1:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

if __name__=="__main__":
    main()

Submission status: Accepted

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


def main():
    integer = {"1","2","3","4","5","6","7","8","9","0"}
    a,b = [int(i) for i in input().strip().split()]
    s = input().strip()
    if len(s) != a + b + 1:
        print("No")
        return
    
    for n in s[:a]:
        if n not in integer:
            print("No")
            return
    if s[a] != "-":
        print("No")
        return
    for n in s[a + 2:]:
        if n not in integer:
            print("No")
            return
    
    print("Yes")
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(len(S)):
  if i == a:
    if not S[a]=="-":
      flag = False
  else:
    if not S[i].isnumeric():
      flag = False
if flag:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
flg1 = s[:a].isdecimal()
flg2 = s[a] == "-"
flg3 = s[-b:].isdecimal()
flg = flg1 and flg2 and flg3
print(["No", "Yes"][flg])

Submission status: Accepted

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

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

if s1.isdigit() and s2=='-' and s3.isdigit():
    print('Yes' , flush=True)
else:
    print('No' , flush=True)

Submission status: Accepted

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = list(input())
if s[a] != '-':
    print('No')
    exit()
s[a]='0'
for i in s:
    if i not in [str(j) for j in range(0,10)]:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = list(input())
for i in range(a+b+1):
    if i < a and not s[i].isdigit():
        print('No')
        exit()
    elif i == a and s[i] != '-':
        print('No')
        exit()
    elif i > a and not s[i].isdigit():
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

ans = "No"

if S[A] == "-":
    if S[:A].isdigit() and S[-B:].isdigit():
        ans = "Yes"
        
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = [int(i) for i in input().split()]
S = input()
try:
    if len(S) != A + B + 1:
        int("a")
    int(S[:A] + S[A+1:])
    if S[A] != "-":
        int("b")
    print("Yes")
except:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

print('Yes')

Submission status: Accepted

Solution code:
import re
A, B = map(int, input().split())
S = input()
print("Yes" if re.fullmatch(r"\d{"+str(A)+r"}-\d{"+str(B)+r"}", S) else "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:
import sys
def input(): return sys.stdin.readline().strip()


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

A,B=map(int,input().split())
S=input()
if S[A]!='-':
  print('No')
  sys.exit()

try:
  int(S[:A])
  int(S[A+1:])
except:
  print('No')
  sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
MM = input().split()
A = int(MM[0])
B = int(MM[1])
S = input()
SS = '1234567890'
SSS =list(SS)
count = 0
for i in range(A):
  if S[i] not in SSS:
    count +=1
if S[A] != '-':
  count +=1
for i in range(A+1,A+B):
  if S[i] not in SSS:
    count +=1
if count ==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
s=s.split('-')
if len(s)!=2 or len(s[0])!=a or len(s[1])!=b:
    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[-b:].isdigit():
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import re
A, B = map(int,input().split())
S = input()
m = '^[0-9]{' + str(A) + '}-[0-9]{' + str(B) +'}$'
if re.match(m, S):
    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')
elif s[a] != '-':
    print('No')
elif s[0:a].isdecimal() == False:
    print('No')
elif s[(a + 1):].isdecimal() == False:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
p = input().split()
a = int(p[0])
b = int(p[1])

v = input()
s = list(v)

answer = False

for i in range(len(s)):
    q = s[i]
    if i == a:
        if q == '-':
            answer = True
        else:
            answer = False
            break
    else:
        if q == '-':
            answer = False
            break
        else:
            answer = True

if answer:
    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()

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# スペース区切りの整数の入力
A, B = map(int, input().split())
S = input()

index = S.find("-")
if S.count("-") != 1:
    print("No")
    exit(0)
if index == -1:
    print("No")
    exit(0)
if len(S[:index]) != A:
    print("No")
    exit(0)
if len(S[index+1:]) != B:
    print("No")
    exit(0)

print("Yes")

Submission status: Accepted

Solution code:
l,m=map(int,input().split())
p=input().split("-")
print('NYoe s'[len(p)==2 and len(p[0])==l and len(p[1])==m::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
import sys
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
mod = 1000000007
inf = float("INF")
def I(): return int(input().rstrip())
def IR(n): return [I() for _ in range(n)]
def LI(): return list(map(int, input().rstrip().split()))
def LIR(n): return [LI() for _ in range(n)]
def LI_(): return list(map(lambda x: int(x) - 1, input().rstrip().split()))
def LIR_(n): return [LI_() for _ in range(n)]
def F(): return float(input().rstrip())
def FR(n): return [F() for _ in range(n)]
def LF(): return list(map(float, input().rstrip().split()))
def LFR(n): return [LI() for _ in range(n)]
def S(): return input().rstrip()
def SR(n): return [S() for _ in range(n)]
def LS(): return list(sys.stdin.readline().rstrip().split())
def LSR(n): return [LS() for _ in range(n)]
# ↑template↑
# ↓solution↑
a, b = LI()
s = S()
if s.count('-') == 1 and a == s.find('-') and b == len(s) - s.find('-') - 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
jdg = True
for i, s in enumerate(S):
    if i != A and s not in '0123456789':
        jdg = False
        break
    if i == A and s != '-':
        jdg = False
print('Yes' if jdg else 'No')

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
ans="Yes"
for i in range(a+b+1):
    if i<a or i>a:
        if s[i].isdecimal()==False:
            ans="No"
    if i==a:
        if s[i]!="-":
            ans="No"
print(ans)

Submission status: Accepted

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

x = s[:a].isdecimal()
if s[a] == "-":
  y = True
else:
  y = False
z = s[a+1:].isdecimal()

if x and y and z == True:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#33 2020/07/14
A, B = input().split(' ')
A = int(A)
B = int(B)
S = input()
if not '-' in S:
  print('No')
else:
  S = S.split('-')
  if '-' in S[0] or '-' in S[1]:
    print('No')
  elif 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 = str(input())
#print(s[:A],s[A+1:A+B+1],s[A])
if s[A] != '-':
    print("No")
    sys.exit()
elif '-' in s[:A] or '-' in s[A+1:A+B+1]:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
#33
import sys
A,B = map(int,input().split())
S = input()
Ans = "No"
if S[A] != "-":
    print(Ans)
    sys.exit()
    
for i in range(A):
    if S[i] == "-":
        print(Ans)
        sys.exit()

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

Ans = "Yes"
print(Ans)

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 = input()
ans = "Yes"
for i in range(len(S)):
  if i == A:
    if S[i] != "-":
      ans = "No"
  else:
    if S[i] == "-":
      ans = "No"
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
f = True
for a in S[:A]:
    if not a.isdecimal():
        f = False
if S[A] != "-":
    f = False
for b in S[A+1:]:
    if not b.isdecimal():
        f = False
if f:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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 = map(int, input().split())
s = input()
t = s[:a] + s[a + 1:]
if s[a] == "-" and t.isdigit():
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
flag=True
for i in range(len(s)):
    if i==a:
        if s[i]!='-':
            flag=False
            break
        continue
    if not(s[i]>='0' and s[i]<='9'):
        flag=False
        break
print("Yes") if flag else print("No")

Submission status: Accepted

Solution code:
import sys

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

for i, j in enumerate(s):
    if i == a:
        if j != '-':
            print('No')
            sys.exit()
    elif j.isdigit():
        continue
    else:
        print('No')
        sys.exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
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:
import sys
a,b = map(int,input().split())
s = input()

if not s[:a].isdigit() or not s[a]=='-' or  not s[a+1:].isdigit():
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

result = True
for i in range(len(sn)):
  if (i == a+1-1) and (sn[i] != "-"):
    result = False
    break
  else :  
    if (i != a+1-1) and ( ord(sn[i]) < 48) or ( 57 < ord(sn[i])):
      result = False
      break

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

Submission status: Accepted

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

import re

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

text = '[0-9]{' + str(A) + '}-[0-9]{' + str(B) + '}'
pattern = re.compile(text)
matchobj = pattern.match(S)

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = list(map(str, input().split("-")))
ans = "No"
if A == len(S[0]):
    if B == len(S[1]):
        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:
import re
A, B = list(map(int, input().split()))
S = input()
if re.match(r'[0-9]{' + str(A) + r'}-[0-9]{' + str(B) + r'}', S):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys,re
input = sys.stdin.readline

a,b=list(map(int,input().split()))
s=input().rstrip()
rs = r"\d"*a+"-"+"\d"*b
print('Yes'if re.match(rs,s) else 'No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import re
a, b, s = open(0).read().split()
r = "^\d{" + a + "}-\d{" + b + "}$"
print("YNeos"[re.findall(r, s) == []::2])

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
            break
    else:
        if s[i] =='-':
            Flag=False
            break 
if Flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = input()
for i in range(a):
    if s[i] == '-':
        print('No')
        exit(0)

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

for i in range(a+1,a+b):
    if s[i] == '-':
        print('No')
        exit(0)

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    a,b = map(int, input().split())
    S = input()

    for i in range(a+b+1):
        if i == a:
            if S[a]!='-':
                print('No')
                return
        else:
            if S[i]=='-':
                print('No')
                return
    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import exit

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())
flag = 0
S = list(input())
if S[A] != "-":
    print("No")
else:
    if "".join(S[:A]).isdigit() and "".join(S[A+1:]).isdigit():
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

if s[a] != "-":
    print("No")
elif len(s.split("-")) != 2:
    print("No")
else:
    h = s.split("-")
    if len(h[0]) == a and len(h[1]) == b:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
a,b,s = open(0).read().split()

if (int(a), int(b)) == tuple(map(len, s.split('-'))):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
S = input()
r = 'Yes'
for i in range(len(S)):
  if i == A:
    jo = ['-']
  else:
    jo = ['0','1','2','3','4','5','6','7','8','9']
  
  if not S[i] in jo:
    r = 'No'
    break
print(r)

Submission status: Accepted

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

if han ==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def actual(a, b, s):
    if s[a] != '-':
        return 'No'

    for i in range(0, a):
        if not '0' <= s[i] <= '9':
            return 'No'

    for j in range(a + 1, len(s)):
        if not '0' <= s[j] <= '9':
            return 'No'

    return 'Yes'


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

print(actual(a, b, s))

Submission status: Accepted

Solution code:
import re


def actual(a, b, s):
    pattern = r'\d{' + f'{a}' + r'}-\d{' + f'{b}' + '}'
    
    if re.fullmatch(pattern, s):
        return 'Yes'

    return 'No'

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

print(actual(a, b, s))

Submission status: Accepted

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

flag = 0


if s[a] == "-":
    if s[:a].isdecimal() and s[a+1:].isdecimal():
        flag = 1
    else:
        flag = 0


if flag:
    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:
    if s[i] != "-":
      print("No")
      exit()
  else:
    if s[i].isdigit() == False:
      print("No")
      exit()
print("Yes")