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()
count = 0

for i in range(a+b+1):
    if s[i] == "-":
        count += 1
        if i != a:
            print("No")
            exit()

if count != 1:
    print("No")
    exit()
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

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

if re.match("^"+"\\d"*A+"-"+"\\d"*B+"$", S):
  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.index('-') == a) and ((len(s) - 1 - s.index('-')) == b) else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

def isPostalCode( A, B, S ):
    for i in range(A):
        if S[i] == '-': return False
    if S[A] != '-': return False
    for i in range(A+1,A+B):
        if S[i] == '-': return False
    return True

if isPostalCode( A, B, S ): print( 'Yes' )
else: print( 'No' )

Submission status: Accepted

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

def all_digit(s):
  return all(d.isdigit() for d in s)

if all_digit(S[:A]) and S[A] == '-' and all_digit(S[A+1:]):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a=int(input()[0]);s=input();print('YNeos'[s.count('-')!=1or'-'<s[a]::2])

Submission status: Accepted

Solution code:
a=int(input()[0]);s=input();print('NYoe s'[s.count('-')==1and'0'>s[a]::2])

Submission status: Accepted

Solution code:
a,b,s=open(0).read().split();a=int(a);print('NYoe s'[s.count('-')==1and'0'>s[a]::2])

Submission status: Accepted

Solution code:
a,b,s=open(0).read().split();a=int(a);print("NYoe s"[s.count("-")==1and s[a]=="-"::2])

Submission status: Accepted

Solution code:
a,b,s=open(0).read().split();a=int(a);print("NYoe s"[s.count("-")==1 and s[a]=="-"::2])

Submission status: Accepted

Solution code:
a,b,s=open(0).read().split();a=int(a)
print("NYoe s"["-"not in(s[:a]+s[a+1:]) and s[a]=="-"::2])

Submission status: Accepted

Solution code:
a,b,s=open(0).read().split();a=int(a)
try:int(s[:a])+int(s[a+1:]);print("YNeos"[s[a]!="-"::2])
except:print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input().split()[0])
s = input()
if (s[:a]+s[a+1:]).replace('0','').replace('1','').replace('2','').replace('3','').replace('4','').replace('5','').replace('6','').replace('7','').replace('8','').replace('9','') or s[a] != '-':
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = list(input())
ans = 'No'
if s[a] == '-':
    s[a] = '0'
    ans = 'Yes'
for i in s:
    if not i.isdigit():
        ans = 'No'    
print(ans)

Submission status: Accepted

Solution code:
""" AtCoder """

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

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

S = S[:A] + S[A+1:]

if '-' in S:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

flg = True

if (len(S) != A + B + 1):
    flg = False
else:
    for i in range(len(S)):
        if i == A and S[i] != '-':
            flg = False
            break
        elif i != A:
            if S[i] < '0' or '9' < S[i]:
                flg = False
                break

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

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
S = str(input())
for i,s in enumerate(S):
    if not i == A and S[i] == '-':
        print("No")
        exit()
print('Yes' if S[A] == '-' and len(S) == A+B+1 else "No")

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import collections
import math

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

if len(S) == A+B+1 and S[A] == "-" and len([ s for s in S if s in [ str(i) for i in range(10)]]) == A+B:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

d = re.compile("\d+")

if (d.match(S[:A])) and S[A] == "-" and d.match(S[A+1:]):
    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:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())


#n = ip()                              #入力整数1つ
x,y= (int(i) for i in input().split())      #入力整数横2つ
#k,a,b = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意

for i in range(x):
    if not('0' <=a[i] and a[i] <= '9') :j(0)
if a[x] !='-' : j(0)
for i in range(x+1,y+x+1):
    if not('0' <=a[i] and a[i] <= '9') :j(0)
j(1)

Submission status: Accepted

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

d = re.compile("\d+")

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

nums = [str(i) for i in range(10)]

if (A + B + 1) != len(S):
    print('No')
    exit(0)

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

print('Yes')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
s = input()
for i,j in enumerate(s):
  if i == a:
    if j != "-":
      print("No")
      exit()
  else:
    if ord("0") <= ord(j) <= ord("9"):
      continue
    else:
      print("No")
      exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input().split();s=input()
if s.count('-')<1 or s.count('-')>1:
    print('No')
elif s[int(a[0])]!='-':
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

int_a, int_b = map(int, input().split())
int_s = input()

pattern = '\d{' + str(int_a) + '}-\d{' + str(int_b) + '}$'

r = re.compile(pattern)

if r.match(int_s):
    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+1:].isdigit()  and s[a]=='-':
    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]=="-" and s[a+1:].isdecimal() else print("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,raw_input().split())

S = raw_input()

data = [str(i) for i in range(10)]

mozi = 'Yes'
if S[A] == '-':
    for i in range(A+B+1):
        if i == A:
            continue
        if S[i] not in data:
            mozi = 'No'
else:
    mozi = 'No'

print mozi

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# encoding:utf-8

import copy
import numpy as np
import random

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# ABC 084
def getIntList(): return [int(x) for x in input().split()]
def db(x): 
    global debug
    if debug: print(x)
debug = False
A,B = getIntList()
S = input()
db((A,B,S))
number = [chr(ord('0')+i) for i in range(10)]
db(number)
if S[A]=='-':
    for i in range(A):
        if not(S[i] in number):
            print('No');break
    else:
        for i in range(A+2,A+B+1):
            if not(S[i] in number):
                print('No');break
        else:
            print('Yes')  
else: 
    print('No')

Submission status: Accepted

Solution code:
def main():
    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")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

for i,x in enumerate(s):
  if i<a and x.isdigit():
    pass
  elif i==a and x=='-':
    pass
  elif a<i and x.isdigit():
    pass
  else:
    print("No")
    sys.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[A+1:].isdigit():
  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()

ans = 'Yes'
if S[a] == '-':
    S = S.replace('-', '', 1)
    for i in S:
        if not i in '1234567890':
            ans = 'No'
else:
    ans = 'No'
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
S = list(input())
ans = True
if len(S) != (A+B+1):
    ans = False
elif S.count("-") != 1:
    ans = False
elif S.index("-") != A:
    ans = False
elif S != [i for i in S if i.isdecimal() or i == "-"]:
    ans = False
if ans:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

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

A, B = inpl()
for i, s in enumerate(list(input())):
    if i < A:
        try:
            int(s)
        except:
            print("No")
            exit()
    elif i == A:
        if s == "-":
            pass
        else:
            print("No")
            exit()
    else:
        try:
            int(s)
        except:
            print("No")
            exit()
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.count("-")==1 and S[A]=="-" else "No")

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = list(input())
flag = 0
if S[A] == "-":
    pass
else:
    flag = 1
    print("No")
high = S.pop(A)
s = "".join(S)
if flag == 0:
    if s.isdecimal():
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
A,B = [int(n) for n in input().split()]
# N = int(input())
S = str(input())
if(S[A] != "-"):
    print("No")
    sys.exit()
S = S[:A] + S[A+1:]
table = [str(n) for n in range(10)]
for s in S:
    if not( s in table):
        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 0<= i <a or a+1<= i <=a+b:
        if not s[i] in list(map(str,[j for j in range(10)])):
            print('No')
            break
    if i == a:
        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].isdecimal() and s[a]=='-' and s[a+1:a+b+1].isdecimal() and len(s[a+1:])==b:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=str(input())
if 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 = str(input())
if 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()
fd=s.find('-')
t=str.maketrans({
	'-':'',
})
#文字列Wの要素を変換する
#'変換前':'変換後'
T=s.translate(t)
c=len(T)
d=len(s)
if fd+1==a+1:
	if c==d-1:
		print('Yes')
	else:
		print('No')
else:
	print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
for i, c in enumerate(s):
    if i != a and not c.isdecimal() or i == a and c != '-':
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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


def main():
    from re import compile

    a, b = map(str, input().split())
    s = input()
    pattern = '[0-9]{' + a + '}-{1}[0-9]{' + b + '}'
    re_pattern = compile(pattern)
    result = re_pattern.match(s)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B=map(int, input().split())
S=input()
if S[A]=="-":
    st=S.split("-")
    n=st[0];m=st[1]
    if n.isdigit() and m.isdigit():
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:

A,B=list(map(int,input().split()))
S=input()
flag=True
if len(S)!=A+B+1:
    flag=False
for i in range(len(S)):
    if i<A or i>A:
        if S[i]!="0" and S[i]!="1" and S[i]!="2" and S[i]!="3" and S[i]!="4" and S[i]!="5" and S[i]!="6" and S[i]!="7" and S[i]!="8" and S[i]!="9":
            flag=False
    else:
        if S[i]!="-":
            flag=False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import re

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

p = "[0-9]{%d}-[0-9]{%d}" % (a, b)

m = re.match(p, s)
if m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
A, B = map(int, input().split())
S = input()
 
if S[A] != "-":
    print("No")
else:
    if "-" in S[0:A] or "-" in S[A+1:]:
        print("No")
    else:
        print("Yes")

Submission status: Accepted

Solution code:
from sys import stdin
a = [int(i) for i in input().split()] 
s = stdin.readline().rstrip()
if s.find('-') != a[0]:
 ans = 'No'
else:
  if s.rfind('-') != a[0]:
   ans = 'No'
  else:
   ans = 'Yes'
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:
# coding: utf-8
import re
A, B = map(int, input().split())
S = input()

if S[A] != "-":
    print("No")
else:
    if "-" in S[0:A] or "-" in S[A+1:]:
        print("No")
    else:
        print("Yes")

Submission status: Accepted

Solution code:
# coding: utf-8
import re
A, B = map(int, input().split())
S = input()

pattern = r"\d{{{}}}-\d{{{}}}".format(A, B)
mo = re.search(pattern, S)

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

Submission status: Accepted

Solution code:
# coding: utf-8
import re
A, B = map(int, input().split())
S = input()

p_regex = re.compile("\d"*A + "-" + "\d"*B)
mo = p_regex.search(S)

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

Submission status: Accepted

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

def main():
    sa = input().split(' ')
    S = input()
    A = int(sa[0])
    B = int(sa[1])

    correct = True
    if len(S) != A + B + 1:
        correct = False
    else:
        for i in range(A + B + 1):
            if i == A:
                if S[i] != '-':
                    correct = False
                    break
            else:
                if S[i] < '0' or '9' < S[i]:
                    correct = False
                    break

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for i, s in enumerate(S):
    if i == A:
        if s.isdigit():
            print("No")
            exit()
    else:
        if not s.isdigit():
            print("No")
            exit()
print("Yes")

Submission status: Accepted

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

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


abc084_b()

Submission status: Accepted

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

flag=0

if s.count('-') == 1:
  s1, s2=[i for i in s.split('-')]
  if len(s1) == a and len(s2) == b :
    flag = 1

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

Submission status: Accepted

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

flag=1

if s.count('-') < 1 or  s.count('-') > 1:
  flag=0
else:
  s1, s2=[i for i in s.split('-')]
#print(s1,s2)
  if len(s1) < a or a < len(s1) or len(s2) < b or b < len(s2):
    flag=0

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

Submission status: Accepted

Solution code:
#B Postal Code
a , b = map(int,input().split())
c = input()
d = len(c)
e = 0
for i in range(d):
    if c[i] =="-" and i != a:
        e = e + 1
if a+b+1 == d and c[a] =="-" and e == 0:
    
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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


def main():
    """Function."""
    a, b = map(int, input().split())
    s = str(input())

    check = set()
    for dum in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]:
        check.add(dum)

    s = list(s)
    flag = 1
    for i in range(len(s)):
        if i == a:
            if s[i] != "-":
                flag = -1
                break

        else:
            if s[i] not in check:
                flag = -1
                break

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
str = input()
s = str.replace('-', '')
if len(s) == a+b and s.isdecimal() and str.rfind('-') == a:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

for i in range(A):
    if S[i] not in NUM:
        print("No")
        quit()

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

for i in range(A + 1, A+B+1):
    if S[i] not in NUM:
        print("No")
        quit()
print("Yes")

Submission status: Accepted

Solution code:
A,B = [int(i) for i in 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:
num = list("1234567890")
a,b = map(int, input().split())
s = input()
if s[a] != "-":
    print("No")
    quit()
s_a,s_b = list(s[:a]),list(s[a+1:])
for i in s_a:
    if i not in num:
        print("No")
        quit()
for i in s_b:
    if i not in num:
        print("No")
        quit()
print("Yes")

Submission status: Accepted

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

if(S[A]=='-'):
    S.pop(A)
else:
    flag=1

if('-' in S):
    flag=1

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

Submission status: Accepted

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

if flag:
    if a==s.find("-"):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
# Postal Code
a, b = map(int, input().split())
s = input()
for i, char in enumerate(s):
    if i == a:
        if char != '-':
            exit(print('No'))
    else:
        if '0' <= char <= '9':
            pass
        else:
            exit(print('No'))
print('Yes')

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=list(input())
flag=0
if S[A]!='-':
    flag=1
S.pop(A)
if '-' in S:
    flag=1
if flag==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split(" "))
c = input()
if c.count("-") == 1:
    ar = c.split("-")
    if len(ar[0]) == a and len(ar[1]) == b:
        print("Yes")
    else:
        print("No")
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 = [int(_) for _ in input().split()]
if re.match('^\d{%s}-\d{%s}$' % (A, B), input()):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

number = ['1','2','3','4','5','6','7','8','9','0']
hyphen = '-'

for i in range(len(s)):
    if i < a:
        if not s[i:i+1] in number:
            print('No')
            break
    elif i == a:
        if s[i:i+1] != hyphen:
            print('No')
            break
    else:
        if not s[i:i+1] in number:
            print('No')
            break
else:
    print('Yes')