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 = list(input())
num = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
if s[a] == '-' and len(s) == (a+b+1) and s.count('-')==1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = input()
ans = "Yes"
try:
    for i in range(a+b+1):
        #print(i,s[i])
        if i < a and s[i].isdigit():
            continue
        elif i == a and s[i] == "-":
            continue
        elif a < i < a+b+1 and s[i].isdigit():
            continue
        else:
            ans = "No"
            break
except:
    ans = "No"

print(ans)

Submission status: Accepted

Solution code:

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

left = s[0:a]
center = s[a]
right = s[a+1:a+b+1]

if left.isdigit() and center == '-' and right.isdigit():
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if any([S.count("-") != 1, S[0] == "-", S[-1] == "-"]):
  print ("No")
else:
  a, b = S.split("-")
  if len(a) == A and len(b) == B:
    print ("Yes")
  else:
    print ("No")

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
s = input()
if s[:x].isnumeric() and s[-y:].isnumeric() and s[x] == '-':
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

if N.count("-")==1:
  temp=N.split("-")
  left=temp[0]
  right=temp[1]
  if (len(left)==A)and(len(right)==B):
    print("Yes")
  else:
    print("No")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
rule=[int(i) for i in input().split()]
nom=input()
if nom[rule[0]]=="-":
  if nom[rule[0]+1:].isdecimal() and nom[:rule[0]].isdecimal():
    print("Yes")
  else:
    print("No")
else:
  print("No")

Submission status: Accepted

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

N = [str(a) for a in range(10)]
ans = 'Yes'
for i, s in enumerate(S):
    if i != A:
        if not s in N:
            ans = 'No'
    else:
        if s != '-':
            ans = 'No'
print(ans)

Submission status: Accepted

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

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

for c in s[0:a]:
    if "0" <= c and c <= "9":
        pass
    else:
        print("No")
        exit()

for c in s[a+1:]:
    if "0" <= c and c <= "9":
        pass
    else:
        print("No")
        exit()

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

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

code = s.split('-')

if len(code[0]) == a and len(code[1]) == b and code[0].isdecimal() and code[1].isdecimal():
    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:
import sys

rule = list(map(int,input().split()))
S = str(input())
S_list = list(S.split('-'))

for i in range(len(S_list)):
	hoge_list = list(S_list[i])
	if len(hoge_list) != rule[i]:
		print('No')
		sys.exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def main():

    A,B = map(int,input().split())
    S = input()
    hihun = S[A]
    other = S[:A]+S[A+1:]

    print('Yes') if hihun == '-' and '-' not in other else print('No')









    
if __name__== "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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


def check(a,b,s):
    number=[str(i) for i in range(10)]
    if s[a]!="-":
        return False
    del s[a]
    if a+b!=len(s):
        return False
    for i in s:
        if not i in number:
            return False
    return True

if check(a,b,s):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

hantei = 1

for i in range(A+B+1):
    if S[i] == "-" and i != A:
        hantei = 0
        break

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

Submission status: Accepted

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

if S.count('-') != 1:
    print('No')
else:
    f,s = S.split('-')
    if len(f) == A and len(s) == B:
        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"]

flag = True

if not all(x in num for x in s[0:a]):
    flag = False

if not s[a] == "-":
    flag = False

if not all(x in num for x in s[a+1:a+1+b]):
    flag = False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 84, b - postal code
import re

X = input().split(' ')

s = input()
if re.match('^(\d{' + X[0] + '}-\d{'+ X[1]+ '})$', s):
    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] < '0' or S[i] > '9':
      print('No')
      exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = [int(x) for x in input().split()]
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

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

pattern = r'^[0-9]{' + a + '}-[0-9]{' + b + '}$'
m = re.match(pattern, s)

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

Submission status: Accepted

Solution code:
import re
a,b = input().split()
s = input()
reg = re.compile(u'[0-9]{%s}-[0-9]{%s}' % (a, b))
print("Yes" if re.match(reg, s) else "No")

Submission status: Accepted

Solution code:
A,B = list(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()
flag = True
for i, ss in enumerate(s):
  if i == a:
    if ss != '-':
      flag = False
  else:
    if ord(ss) not in range(ord('0'), ord('9')+1):
      flag = False

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

#n = int(input())
#a = int(input())
a,b = list(map(int,input().split(" ")))
#ls = list(input().split(" "))
#ls = list(map(int,input().split(" ")))
#a,b = list(input().split())
string = input()
#ls = [int(input()) for i in range(n)]
try:
  int(string[0:a])
  int(string[a+1:a+b+1])
  if string[a] == "-":
    print("Yes")
  else:
    print("No")
except:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
ans="Yes"
front=""
back=""
if s.count("-")!=1:
    ans="No"
else:front,back=s.split("-")
if len(front)!=a or len(back)!=b:
    ans="No"
print(ans)

Submission status: Accepted

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

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

t = S.split("-")
if len(t) != 2:
    print("No")
else:
    if len(t[0]) == A and len(t[1]) == B:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = list(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:
# ABC084-B
A, B = map(int, input().split())
S = input()
ans = 'No'
flag = True
num = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
if S[A] == '-':
    aa = S[0:A]
    bb = S[A+1:A+B+1]
    for i in range(len(aa)):
        if aa[i] not in num:
            flag  = False
    for k in range(len(bb)):
        if bb[k] not in num:
            flag = False
    if flag:
        ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
try:
    Anum = (int)(s[:a])
    Bnum = (int)(s[b:])
    if s[a] == '-':
        print("Yes")
    else:
        print("No")
except ValueError:
    print("No")

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = input()
s1 = s[:a]+s[a+1:]
print('YNeos'['-' in s1 or '-' != s[a]::2])

Submission status: Accepted

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

if s.count("-") == 0 or s.count("-") > 1:
  print("No")
  exit()

if s[0] == "-" or s[-1] == "-":
  print("No")
  exit()

if len(s.split("-")[0]) != a:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
c = input()
d = "1234567890"
for i in range(a):
    if c[i] not in d:
        print("No")
        exit()
for i in range(len(c)-1, len(c)-1-b, -1):
    if c[i] not in d:
        print("No")
        exit()
if c[a] != "-":
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

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 LIST(): return list(map(str, input().split()))
def LIST(): return list(input())

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()
S = LIST()
flag = False
if len(S) == A + B + 1:
    if S[A] == "-":
        for i in range(A):
            if S[i] != "-":
                for j in range(B):
                    if S[-1-j] != "-":
                        flag = True
if flag == True:
    print("Yes")
else:
    print("No")

# 15:51

Submission status: Accepted

Solution code:
import re
a, b = map(int, input().split())
s = input().rstrip()
result = 'Yes'

if len(s[:a]) != a or len(s[a+1:]) != b:
    result = 'No'
if re.fullmatch(r'\d+', s[:a]) is None or\
        re.fullmatch(r'\d+', s[a+1:]) is None:
    result = 'No'
if s[a:a+1] != '-':
    result = 'No'

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

if c[a]=='-':
    for i in range(len(c)):
        if i==a:
            pass
        elif c[i]=='-':
            print('No')
            exit()
    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] == "-":
  try:
    int(t)
    print("Yes")
  except:
    print("No")
else:print("No")

Submission status: Accepted

Solution code:
import sys

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
ans = 'No'
try:
    s1, s2 = s.split('-')
    if a == len(s1) and b == len(s2):
        ans = 'Yes'
except ValueError:
    pass
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if S[A] == "-":
    haihun = True

if "-" in S[:A]:
    number = False

for i in S[A+1:]:
    if i == "-":
        number = False
        break
    if int(i) < 0 or int(i) > 9:
        number = False
        break
    else:
        continue


if haihun and number:
    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] == '-' and s[:a].isdecimal() and s[a+1:].isdecimal():
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = list(input())
num = '0123456789'
ans = 0

for i in range(A):
    for n in num:
        if S[i] == n:
            ans += 1

if S[A] == '-':
    ans += 1

for j in range(B):
    for n in num:
        if S[A + 1 + j] == n:
            ans += 1

if ans == A + B + 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
postal = input().split('-')
ans = 'Yes'
if len(postal) != 2:
	ans = 'No'
else:
	if len(postal[0]) != A or len(postal[1]) != B:
		ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
import re

A, B = map(int, input().split())
S = input()
pattern = re.compile("^[0-9]{%d}-[0-9]{%d}$" % (A, B))
print("Yes" if pattern.match(S) else "No")

Submission status: Accepted

Solution code:
import re
a,b=map(int,input().split())
s=input()
if re.search(r"^([0-9])*$",s[:a]) and s[a]=="-" and re.search(r"^([0-9])*$",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()
check = [i for i in range(10)]
ans = 0

for i in range(A + B + 1):
    if i != A:
        if S[i] == '-':
            print('No')
            ans = 1
            break
        elif int(S[i]) not in check:
            print('No')
            ans = 1
            break
    else:
        if S[i] != '-':
            print('No')
            ans = 1
            break

if ans == 0:
    print('Yes')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
a= input().split('-')
if len(a[0]) == A and len(a[1]) == B:
  print('Yes')
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 = list(str(input()))
hi = s.pop(a)
if hi != "-":
    print("No")
    exit()
if all([i.isdecimal() for i in 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")
    exit()

for i,s in enumerate(S):
    if i == A:
        if s != "-":
            print("No")
            exit()
    else:
        if not "0" <= s <= "9":
            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].isnumeric() and s[a] == '-' and s[a+1:].isnumeric():
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(a):
    if s[i] == '-':
        ans = 'No'

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

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

print(ans)

Submission status: Accepted

Solution code:
nums = list(map(str, range(10)))
a, b = map(int, input().split())
s = input()
cnt = 0
for i in range(a):
    if s[i] in nums:
        cnt+=1
if s[a] == "-":
    cnt += 1
for i in range(a+1,a+b+1):
    if s[i] in nums:
        cnt += 1

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

Submission status: Accepted

Solution code:
a, b = map(int,input().split())
s = input()
l = [False]*a
l1 = [False]*b
l2 = ["1","2","3","4","5","6","7","8","9","0"]
s1 = s[:a]
s2 = s[a+1:]
for k,i in enumerate(s1):
  if i in l2:
    l[k] = True
for k, i in enumerate(s2):
  if i in l2:
    l1[k] = True
if all(l) and all(l1) and s[a] == "-":
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

if s.count("-")>1:
    print("No")
    exit()

if s[a+1]=="-":
    print("Yes")

else:
    print("No")

Submission status: Accepted

Solution code:

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

S = input()

num = "0123456789"

ans = "Yes"

if len(S) != A+B+1:
    ans = "No"

for i in range(len(S)):

    if i != A and S[i] not in num:
        ans = "No"

    if i == A and S[i] != "-":
        ans = "No"

print (ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()


A, B = nl()
S = s()

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

Submission status: Accepted

Solution code:
a,b=input().split()
a=int(a)
S=input()
print(["No","Yes"][S[a]=="-" and S.count("-")==1])

Submission status: Accepted

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

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

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

Submission status: Accepted

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

for i in range(len(S)):

    if i==A:
        if S[i]!="-":
            print("No")
            exit()
    else:
        if not ord('0')<=ord(str(S[i]))<=ord('9'):
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
a, b = map(int,input().split())
s = input()
for c in range(len(s)):
  if c < a:
    if s[c] != '-':
      continue
    else:
      break
  elif c == a:
    if s[c] == '-':
      continue
    else: break
  elif c < a+b+1:
    if s[c] != '-':
      continue
    else: break
  else:break
else:
  print('Yes')
  exit(0)
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


abc()

Submission status: Accepted

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

Submission status: Accepted

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

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

def is_all_num(test):
    for c in test:
        if c not in "0123456789":
            return False
    return True

def solve(A: int, B: int, S: str):
    if S[A] == "-" and is_all_num(S[0:A]) and is_all_num(S[A+1:]):
        print(YES)
    else:
        print(NO)

# Generated by 1.1.4 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())
try:
  C,D=input().split("-")
  if len(C)==A and len(D)==B:
    print("Yes")
  else:
    print("No")
except:
  print("No")

Submission status: Accepted

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

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

sys.setrecursionlimit(2147483647)
INF = float("inf")

A, B = list(map(int, sys.stdin.readline().split()))
S = sys.stdin.readline().rstrip()

ok = True
ok &= len(S) == A + B + 1
ok &= S[A] == '-'
ok &= bool(re.match('^[0-9]*$', S[:A] + S[A + 1:]))
if ok:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# coding: utf-8
import time
import re
import math

def main():
    A,B=map(int,input().split())
    S=input()
    f=1
    if S.count("-")==1:
        if S.index("-")!=A:
            f=0
    else:
        f=0
    if(f==1):print("Yes")
    else:print("No")
main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import re

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

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

Submission status: Accepted

Solution code:
import sys
a,b = map(int, input().split())
ad = list(input())

if ad.pop(a)=="-":
    try:
        int("".join(ad))
        print("Yes")
    except: print("No")
else: print("No")

Submission status: Accepted

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

if ad.pop(a)=="-":
    try:
        int("".join(ad))
        print("Yes")
    except: print("No")
else: print("No")