Problem:


Score : 200 points

Problem Statement

The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.

You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.

Constraints

1≤A,B≤5

|S|=A+B+1

S consists of - and digits from 0 through 9.

Input

Input is given from Standard Input in the following format:

A B
S

Output

Print Yes if S follows the postal code format in AtCoder Kingdom; print No otherwise.

Sample Input 1

3 4
269-6650

Sample Output 1

Yes

The (A+1)-th character of S is -, and the other characters are digits from 0 through 9, so it follows the format.

Sample Input 2

1 1
---

Sample Output 2

No

S contains unnecessary -s other than the (A+1)-th character, so it does not follow the format.

Sample Input 3

1 2
7444

Sample Output 3

No



Sample input:
3 4
269-6650


Sample output:
Yes

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    s = str(input().rstrip('\n'))
    ls = list("1234567890")
    for i in range(len(s)):
        if i < a:
            if s[i] not in ls:
                print("No")
                exit()
        elif i == a:
            if s[i] != "-":
                print("No")
                exit()
        elif b <= i:
            if s[i] not in ls:
                print("No")
                exit()
    print("Yes")


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
import re
a,b = list(map(int, input().split()))
s = input()
pattern = re.compile(r"^\d{%d}-\d{%d}$" % (a,b))
print("Yes" if re.match(pattern, s) else "No")

Submission status: Accepted

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

Submission status: Accepted

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

s = input()
n = s[:a]+s[a+1:]

print("Yes" if s[a]=="-" and n.isdigit() else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B=map(int,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:
line1 = [int(x) for x in input().strip().split()]
a = line1[0]
b = line1[1]

s = input().strip()

if s.count('-') != 1:
	print('No')
	exit(0)

components = s.split('-')
part1 = components[0]
part2 = components[1]

if len(part1) != a or len(part2) != b:
	print('No')
	exit(0)

for c in part1:
	if c < '0' or c > '9':
		print('No')
		exit(0)

for d in part2:
	if d < '0' or d > '9':
		print('No')
		exit(0)

print('Yes')

Submission status: Accepted

Solution code:
A,B = map(int, input().strip().split(' '))
S = input().strip()
S_ = ''.join(['0' if c in '0123456789' else c for c in S])
print('Yes' if S_ == '{}-{}'.format('0'*A,'0'*B) else 'No')

Submission status: Accepted

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

try:
    int(S[:A])
    int(S[A:])
except :
    print('No')
    exit()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = list(input())
if S[A] != '-':
    print('No')
    exit()
S.remove('-')
for s in S:
    if s.isdigit() == False:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

def main():
  a,b = map(int,input().split())
  s = input()
  target = r'^[0-9]{%d}-[0-9]{%d}$' % (a, b)
  postal_code = re.compile(target)
  
  if postal_code.match(s) is not None:
    print('Yes')
  else:
    print('No')

if __name__ == "__main__":
  main()

Submission status: Accepted

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

def solve() :
    for i in range(A+B+1) :
        if 0 <= i < A or A + 1 <= i <= A + B :
            if not 48 <= ord(S[i]) <= 57 :
                return 'No'
        else :
            if S[i] != '-' :
                return 'No'
    return 'Yes'
print(solve())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


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

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

X = map(int, S[:A:])
try:
    X = list(map(int, S[:A:]))
    Y = list(map(int, S[A + 1::]))
except:
    print("No")
    exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    A, B = map(int, input().split())
    s = input().strip()

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
A, B = map(int, input().split())
S = input()
num_list = list(map(str, list(range(0, 10, 1))))
ans_cnt = A + B + 1
cnt = 0
for i, s in enumerate(S):
    if i == A:
        if s == "-":
            cnt += 1
    else:
        if s in num_list:
            cnt += 1
if cnt == ans_cnt:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

A, B = ISI()
S = IS()
Num = ["0","1", "2", "3", "4", "5", "6", "7", "8", "9"]
a = S[:A]
b = S[A+1:]
c = S[A]
good = True
for _a in a:
    if _a in Num:
        continue
    else:
        good = False
for _b in b:
    if _b in Num:
        continue
    else:
        good = False
if c != "-":
    good = False
if good == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# ABC084b
import sys
import re
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

a, b = map(int, input().split())
s = input()[:-1]

print('Yes' if re.fullmatch(
    '[0-9]{' + str(a) + '}-[0-9]{' + str(b) + '}', s) != None else 'No')

Submission status: Accepted

Solution code:
a,_,s=open(0).read().split();print("YNeos"[s.count("-")>1or"-"!=s[int(a)]::2])

Submission status: Accepted

Solution code:
import re;a,_,s=open(0).read().split();print("YNeos"[s.count("-")>1or"-"!=s[int(a)]::2])

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()
b = ''.join(S[:A]).isdigit() and S[A] == '-' and ''.join(S[A+1:]).isdigit() and len(S) == A + B + 1
print('Yes' if b else 'No')

Submission status: Accepted

Solution code:
import re
A, B = map(int, input().split())
S = input()
postal = "^\d{{{}}}-\d{{{}}}$".format(A, B)
is_postal = re.match(postal, S)
if is_postal:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
numbers = ["0","1","2","3","4","5","6","7","8","9"]
A, B = map(int, input().split())
S = input()
f = True
for i in range(0,A):
  if S[i] not in numbers:
    f = False
for i in range(A+1,A+B+1):
  if S[i] not in numbers:
    f = False
if S[A] != "-":
  f = False
if f:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

l=s.split("-")
if len(l)!=2 or len(l[0])!=a or not l[0].isdigit() or len(l[1])!=b or not l[1].isdigit():
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    s = str(input().rstrip('\n'))
    ls = list("0123456789")
    for i in range(len(s)):
        if i == a:
            if s[i] != "-":
                print("No")
                exit()
        else:
            if s[i] not in ls:
                print("No")
                exit()
    print("Yes")


if __name__ == '__main__':
    slove()

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=input()
print(("No","Yes")[s[a]=="-" and s[:a].isnumeric() and s[a+1:].isnumeric() and len(s)==a+b+1])

Submission status: Accepted

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

ans = s.split("-")

if len(ans) != 2:
    print("No")
elif len(ans[0]) == a and len(ans[1]) == b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
from statistics import *
from collections import *
from operator import itemgetter

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

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

Submission status: Accepted

Solution code:

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

if len(line) != 2:
  print("No")

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    A, B = map(int, input().split())
    S = list(str(input()))
    flag = True
    if S[A] == '-':
        S[A] = 0
    else:
        flag = False
    for i in range(A+B+1):
        try:
            int(S[i])
        except ValueError:
            flag = False
            break
    if flag:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

# solution
res = 'Yes'
for i in range(len(S)):
    if i == A:
        if S[i] != '-':
            res = 'No'
            break
    else:
        if S[i] not in '0123456789':
            res = 'No'
            break

# output
print(res)

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

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()
valid = True
for i in range(len(s)):
    if (i + 1) <= a:
        if not ('0' <= s[i] <= '9'):
            valid = False
            break
    elif i + 1 == a + 1:
        if not s[i] == '-':
            valid = False
            break
    else:
        if not ('0' <= s[i] <= '9'):
            valid = False
            break
if valid is False:
    print('No')
else:
    print("Yes")

Submission status: Accepted

Solution code:
import re


def resolve():
    a, b = input().split()
    s = input()
    pattern = "\\d{{{a}}}-\\d{{{b}}}".format(a=a, b=b)
    if re.match(pattern, s):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def test():
    a,b = map(int,input().split())
    s = input()
    for i in range(a):
        if s[i].isdigit():
            pass
        else:
            print("No")
            return
    for j in range(a+1,len(s)):
        if s[j].isdigit():
            pass
        else:
            print("No")
            return
    if s[a] == "-":
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    test()

Submission status: Accepted

Solution code:
a, _ = 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()
SA = S[0:A]
SB = S[A+1:A+B+1]
if not(all(map(lambda c: c in "0123456789", SA))):
  print("No")
  exit()
if not(S[A] == "-"):
  print("No")
  exit()
if not(all(map(lambda c: c in "0123456789", SB))):
  print("No")
  exit()
print("Yes")

Submission status: Accepted

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

for i in range(l):
    if i == A:
        if S[i] != '-':
            print("No")
            exit()
    else:
        if S[i].isdigit():
            continue
        else:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    a, b = map(int, input().rstrip('\n').split())
    s = input().rstrip('\n')
    ls = list("1234567890")
    for i in range(len(s)):
        if i < a:
            if s[i] not in ls:
                print("No")
                exit()
        elif i == a:
            if s[i] != "-":
                print("No")
                exit()
        elif b <= i:
            if s[i] not in ls:
                print("No")
                exit()
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    a, b = map(int, input().rstrip('\n').split())
    s = input().rstrip('\n')
    ls = list("1234567890")
    for i in range(a + b + 1):
        if i < a:
            if s[i] not in ls:
                print("No")
                exit()
        elif i == a:
            if s[i] != "-":
                print("No")
                exit()
        elif b <= i:
            if s[i] not in ls:
                print("No")
                exit()
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if S[:A].isalnum() and S[A] == "-" and S[-B:].isalnum():
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

abc='0123456789'
ans='Yes'
for i in range(a):
    if s[i] not in abc:
        ans='No'
        break
if s[a]!='-':
    ans='No'

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

Submission status: Accepted

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

Submission status: Accepted

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

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("-")
s.append("-")

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

Submission status: Accepted

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


pC()

Submission status: Accepted

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

ans = True

for i in range(len(s)):
    if i == a:
        if s[i] != '-':
            ans = False
    else:
        if s[i] < '0' or '9' < s[i]:
            ans = False

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

Submission status: Accepted

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

Submission status: Accepted

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

for i,tmp in enumerate(s):
  if s.count('-')!=1:
    print('No')
    exit()
  if i==a and tmp!='-':
    print('No')
    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 s[a+1:].isdecimal():
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

    ls = "0123456789"
    c = 0
    for i in s:
        if i in ls:
            c += 1

    if c == a+b:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
s = input()
number = ['0','1','2','3','4','5','6','7','8','9']
cnt = 0

for i in range(a):
  if s[i] in number :
    cnt = cnt +1
    
if s[a] == '-':
  cnt = cnt +1
      
for j in range(a+1,a+b+1):
  if s[j] in number :
    cnt = cnt + 1

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

Submission status: Accepted

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

S = input()

if S[A] == "-":
    if S[:A].isdigit():
        if S[A+1:].isdigit():
            print("Yes")
            exit(0)

print("No")

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 and S[i] != "-":
            return "No"
        if i != A and S[i] == "-":
            return "No"
    return "Yes"

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b =map(int, input().split())
s =input()
 
def main(a,b,s):
  if len(s) != a+1+b :
    return 'No'
 
  for n,i in enumerate(s) :
    if n == a :
      
      if i != '-' :
        return 'No'
    else :
      try :
        int(i)
      except :
        return 'No'
  return 'Yes'
              
print(main(a,b,s))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
a, b = map(int, input().split())
s = input()
if len(s) != a+b+1:
    print('No')
    sys.exit()

def check_hi(index,str):
    tmp = []
    for i,st in enumerate(str):
        if st == '-':
            tmp.append(i)
    if len(tmp)==1 and tmp[0]==index:
        return True
    else:
        return False

def check_int(i):
    if i == '-' or int(i) in [0,1,2,3,4,5,6,7,8,9]:
        return True
    else:
        return False

if check_hi(a,s) == False:
    print('No')
    sys.exit()

for si in s:
    if check_int(si) == False:
        print('No')
        sys.exit()
else:
    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()

for i in range(A):
    if 48 > ord(S[i]) or ord(S[i]) > 57:
        print('No')
        exit(0)
if S[A] != '-':
    print('No')
    exit(0)
for i in range(A + 1, len(S)):
    if 48 > ord(S[i]) or ord(S[i]) > 57:
        print('No')
        exit(0)
print('Yes')

Submission status: Accepted

Solution code:
a,b,*s=open(0).read().split()
s=s[0].split('-')
if len(s)==2 and len(s[0])==int(a) and len(s[1])==int(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 and S[a] == '-' and S.count('-') == 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

pattern = '[0-9]{' +str(a)+ '}-[0-9]{' +str(b)+ '}'

search_result = re.search(pattern, content)

if not(search_result) :
  print("No")
elif search_result.group() == content:
  print('Yes')
else:
  print("No")

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
isvalid = all("0" <= c <= "9" for c in S[:A] + S[-B:]) and S[A] == "-"
print("Yes" if isvalid else "No")

Submission status: Accepted

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

if 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 = input()
nums = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
isvalid = all(c in nums for c in S[:A] + S[-B:]) and S[A] == "-"
print("Yes" if isvalid else "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']
count = 0

for i in range(len(s)):
    if 0 <= i and i <= a-1:
        if s[i] not in num:
            print('No')
            count += 1
            break
    elif i == a:
        if s[i] != '-':
            print('No')
            count += 1
            break
    else:
        if s[i] not in num:
            print('No')
            count += 1
            break

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

Submission status: Accepted

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

if S[A] == '-':
    try:
        int(S[:A] + '0' + S[A + 1:])
    except:
        print("No")
        exit()
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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