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:
# coding: utf-8

#問題文
#Atcoder国では、郵便番号は A+B+1 文字からなり、A+1 文字目はハイフン -、それ以外の全ての文字は 0 以上 9 以下の数字です。
#例：1111-11111
#文字列 S が与えられるので、Atcoder国の郵便番号の形式を満たすかどうか判定してください。
#
#制約
#1≦A,B≦5
#|S|=A+B+1
#S は 0 以上 9 以下の数字、およびハイフン - からなる
#入力
#入力は以下の形式で標準入力から与えられる。
#
#A B
#S
#出力
#S がAtcoder国の郵便番号の形式を満たすならば Yes 、そうでなければ No を出力せよ。

import re

a, b = input().split(" ")
s = input()

regex = "[0-9]{" + a + "}-[0-9]{" + b + "}"
match_res = re.fullmatch(regex, s)

ans = "No"
if(match_res != None):
   ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
import re

a, b = raw_input().split(" ")
s = raw_input()
 
pat = '^\d{' + a + '}-\d{' + b + '}$'
print "Yes" if (re.match(pat, s) is not None) else "No"

Submission status: Accepted

Solution code:
#abc084b
import sys

a,b=map(int,raw_input().split())
s=raw_input()
if s[a] != '-':
 print 'No'
 sys.exit()
for i in xrange(a):
 if s[i].isdigit()==False:
  print 'No'
  sys.exit()
for i in xrange(a+1,a+1+b):
 if s[i].isdigit()==False:
  print 'No'
  sys.exit()
print 'Yes'

Submission status: Accepted

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

res = True
if S[A] != '-':
	res = False

if res == True:
	for i in range(len(S)):
		if i == A:
			continue
		else:
			if S[i] >= "0" and S[i] <= "9":
				continue
			else:
				res = False
				break

print("Yes" if res == True else "No")

Submission status: Accepted

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

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

    for p in [s[0:a],s[a+1:]]:
        for c in p:
            if not c.isdigit():
                return 'No'

    return 'Yes'

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

Submission status: Accepted

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

res = 'No'
sp = s.split('-')
if len(sp) == 2:
  if len(sp[0]) == a:
    res = 'Yes'
print(res)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
a,b = map(int,raw_input().split())
s = raw_input()
flg = True

for i in range(0,a):
    if(not('0'<=s[i] and s[i]<='9')):flg = False
if(s[a] != '-'):flg = False
for i in range(a+1,a+b+1):
    if(not('0'<=s[i] and s[i]<='9')):flg = False
print('Yes' if flg else 'No')

Submission status: Accepted

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

    valid = False
    if S.count("-") == 1:
        s_a, s_b = S.split("-")
        if len(s_a) == A and len(s_b) == B:
            valid = True

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#coding:utf-8

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

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

else:
    Flag = 0
    for i in range(A):
        if (S[i] < '0' or S[i] > '9'):
            Flag = 1
            #print "hello1"
    for i in range(A+1,len(S)):
        if (S[i] < '0' or S[i] > '9'):
            Flag = 1

    if Flag == 1:
        print "No"
    else:
        print "Yes"

Submission status: Accepted

Solution code:
#coding:utf-8

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

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

else:
    Flag = 0
    for i in range(A):
        if (S[i] >= '0' and S[i] <= '9') == False:
            Flag = 1
            #print "hello1"
    for i in range(A+1,len(S)):
        if (S[i] >= '0' and S[i] <= '9') == False:
            Flag = 1

    if Flag == 1:
        print "No"
    else:
        print "Yes"

Submission status: Accepted

Solution code:
print['No','Yes'][map(int,raw_input().split())==map(len,raw_input().split('-'))]

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    a,b = LI()
    s = S()
    if len(s) != a+b+1:
        return 'No'
    for i in range(a):
        if not ('0' <= s[i] <= '9'):
            return 'No'
    if s[a] != '-':
        return 'No'
    for i in range(b):
        if not ('0' <= s[i+a+1] <= '9'):
            return 'No'

    return 'Yes'

print(main())

Submission status: Accepted

Solution code:
a,b = map(int,raw_input().split())
s = raw_input()
no = 0;
for i in range(len(s)):
	if i == a and s[i] != '-':
		no = 1;
	elif i != a and s[i] == '-':
		no = 1;

if no:
	print 'No'
else:
	print 'Yes'

Submission status: Accepted

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


try:
    s1,s2=s.split("-")
except Exception as e:
    print('No')
    sys.exit()

if(not s1.isdigit() or not s2.isdigit()):
    print('No')
    sys.exit()

if(len(s1)!=a or len(s2)!=b or len(s2)>5):
    print('No')
    sys.exit()

print('Yes')

Submission status: Accepted

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

flag = 0

for i in range(len(S)):
    if S[i] == '-':
        if i == A:
            flag = 1
        else:
            flag = 0
            break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
num = list(map(int, input().split()))
string = input()
length = num[0] + num[1] + 1
flag = False

for i in range(num[0]):
    if string[i].isdigit():
        flag = True
    else :
        flag = False
        break

if string[num[0]] == '-' and flag:
    for i in range(num[0] + 1, length):
        if string[i].isdigit():
            flag = True
        else:
            flag = False
            break
else:
    flag = False

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

Submission status: Accepted

Solution code:
def check_int(num):
    try:
        int(num)
        return True
    except:
        return False

a, b = map(int, raw_input().split(" "))
s = raw_input().split("-")
if len(s) != 2:
    print 'No'
else:
    flag = True
    for i in s:
        if not check_int(i):
            flag = False
    if flag:
        if len(s[0]) == a and len(s[1]) == b:
            print 'Yes'
        else:
            print 'No'
    else:
        print 'No'

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a,b = map(int,input().split())
S = str(input())
ans = str(S[a])
l = len(S)
c = 0
wr = 0
while c < l:
    if c == a:
        if "-" != ans:
            wr = 1
            break
        else:
            c += 1
    else:
        if "-" == str(S[c]):
            wr = 1
            break
        else:
            c += 1
if wr == 1:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
b = input()
c = True
for i in range(a[0]):
    try:
        if 0 <= int(b[i]) <= 9:
            pass
    except:
        c = False
if b[a[0]] == "-":
    pass
else:
    c = False
for i in range(a[1]):
    try:
        if 0 <= int(b[i + a[0] + 1]) <= 9:
            pass
    except:
        c = False
if len(b) != a[0] + a[1] + 1:
    c = False
if c == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import re
a,b = input().strip().split(" ")
a = int(a)
b = int(b)
s = str(input()).strip()
s_pattern='^[0-9]{{{a}}}-[0-9]{{{b}}}$'.format(a=a,b=b)
pattern = re.compile(s_pattern)
m = pattern.match(s)
if m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

P=len(S)

X=0

for i in range(A):
    if S[i]!="-":
        X=X+1
        
if S[A]=="-":
       X=X+1
        
for i in range(A+1,B+A+1):
    if S[i]!="-":
        X=X+1

if X==P:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

for i in list(s):
    if i == '-':
        d += 1

try:
    map(int, s.split('-'))
    if len(s) == a + b + 1 and s[a] == '-' and d < 2:
        print('Yes')
    else:
        print('No')
except:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b = map(int, raw_input().split())
# 文字列の入力
s = raw_input()
list = [ ]
list = s.split ( '-' )
if ( len(list[0]) == a and len(list[1]) == b):
    print "Yes"
    exit()
print "No"

Submission status: Accepted

Solution code:
ab = list(map(int, input().split()))
a = ab[0]
b = ab[1]

s = list(input())
fff = "Yes"

for i in range(0, len(s)):
    if i == a:
        if s[i] != "-":
            fff = "No"
    else:
        if s[i] not in "0123456789":
            fff = "No"

print(fff)

Submission status: Accepted

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

res = True

if S[A] != '-':
  res = False

for i in range(A+B+1):
  if S[i] not in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] and i != A:
    res = False

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

Submission status: Accepted

Solution code:
#coding:utf-8
a,b = (int(i) for i in input().split())
s = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=map(int,raw_input().split());t=map(len,raw_input().split('-'));print['No','Yes'][a==t]

Submission status: Accepted

Solution code:
a=map(int,raw_input().split());t=map(len,raw_input().split('-'));print'Yes'if a==t else'No'

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
ans = "Yes"
if S[A] != "-":
    ans = "No"
if any([c == '-' for c in S[:A]]):
    ans = "No"
if any([c == '-' for c in S[A+B:]]):
    ans = "No"
print(ans)

Submission status: Accepted

Solution code:
import re

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

def is_num(s, n):
    return len(s) == n and (re.match(r"[0-9]+", s) is not None)

if is_num(s[:a], a) and s[a] == "-" and  is_num(s[a+1:], b):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
AB = input()
S = input()

A = int(AB.split(" ")[0])
B = int(AB.split(" ")[1])

ints = "0123456789"


flag = True

if len(S) != A + B + 1:
    flag = False

if flag:
    for i in range(len(S)):
        if i != A:
            if not(S[i] in ints):
                flag = False
        else:
            if S[i] != "-":
                flag = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    info = list(map(int,input().split(" ")))
    S = input()
    if S[:info[0]].isdigit() and S[info[0]] == "-" and S[info[0]+1:].isdigit():
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 30 21:39:36 2017

@author: kanako_note
"""

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

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

Submission status: Accepted

Solution code:
import re

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

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

if re.match(p, s) is None:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import re

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

if re.match('^[0-9]{{{}}}-[0-9]{{{}}}$'.format(a,b), s) :
    print('Yes')
else :
    print('No')

Submission status: Accepted

Solution code:
import re

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

if re.match('^[0-9]{' + a + '}-[0-9]{' + b + '}$', s):
    print('Yes')
else :
    print('No')

Submission status: Accepted

Solution code:
# スペース区切りの整数の入力
a, b= map(int, input().split())
string = input()

flag = 1

for i in range(a):
    if string[i] == '-':
        flag = 0

if string[a] != '-':
    flag = 0

for i in range(a+1,a+b+1):
    if string[i] == '-':
        flag = 0

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

else:
    print("No")

Submission status: Accepted

Solution code:
import re
A, B = (int(i) for i in input().split())
if re.match(r"\d{%s}-\d{%s}" % (A, B), input()):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
[a, b] = [int(i) for i in input().split()]
s = input().strip()
if (s[a] == "-") and (sum([c in "0123456789" for c in s]) == a + 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:
num = raw_input().split(" ")
l = raw_input().split("-")

if len(l) == 2 and len(l[0]) == int(num[0]) and len(l[1]) == int(num[1]):
  print "Yes"
else:
  print "No"

Submission status: Accepted

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

det = "Yes"

for i in range(len(s)):
    if i < a and (ord(s[i]) < ord('0') or ord(s[i]) > ord('9')):
        det = "No"
        break
    elif i == a and s[i] != '-':
        det = "No"
        break
    elif i > a and (ord(s[i]) < ord('0') or ord(s[i]) > ord('9')):
        det = "No"
        break

print(det)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import re

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

if re.match(r'\d{' + a + '}-\d{' + b + '}', s):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

if S[0:A[0]].isdigit() == False or S[A[0]+1:].isdigit() == False or S[A[0]] != '-' or len(S[0:A[0]]) != A[0] or len(S[A[0]+1:]) != A[1] :
	print('No')
else:
	print('Yes')

Submission status: Accepted

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

if len(posts) == 2:
    if a == len(posts[0]) and b == len(posts[1]) and posts[0].isnumeric() and posts[1].isnumeric():
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
data = input().split()
A = int(data[0])
B = int(data[1])
S = input()
s1 = S[:A]
s2 = S[A:A+1]
s3= S[len(S)-B:]
if s1.isdigit() == True:
    if s2 == "-":
        if s3.isdigit() == True:
            print("Yes")
        else : 
            print("No")
    else:
        print("No")
else :
    print("No")

Submission status: Accepted

Solution code:
from re import match
import sys
AB = list(map(int,input().split()))
print("Yes" if match("[0-9]{%d}-[0-9]{%d}"%(AB[0],AB[1]),input()) else "No")

Submission status: Accepted

Solution code:
[a, b] = list(map(int, input().split()))
s = str(input())
finalAns = True
for p in range(a + b):
    if p == a:
        if s[p] != "-":
            finalAns = False
    else:
        if s[p].isdigit == False or s[p] == "-":
            finalAns = False

if finalAns == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

for n in range(len(S)):
    if n is A:
        if S[n] is not '-':
            print('No')
            sys.exit()
    else:
        if S[n] not in ['0','1','2','3','4','5','6','7','8','9']:
            print('No')
            sys.exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

S = input()

l=['0','1','2','3','4','5','6','7','8','9']
#print(l)


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


for i in range(A):
	if S[i] in l:
		continue
	
	print("No")
	exit(0)


for i in range(A+1, A+B+1):
	if S[i] in l:
		continue
	
	print("No")
	exit(0)


print('Yes')

Submission status: Accepted

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

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

Submission status: Accepted

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


if len(S) != A + B + 1 or '-' not in S or not re.match('[0-9\-]', S[-1]):
    print 'No'
else:
    a, b = map(len, S.split('-'))[:2]
    if a != A or b != B:
        print 'No'
    else:
        print 'Yes'

Submission status: Accepted

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

A_ = A+1
value = list(map(str ,list(range(10))))
count = 1
flag = True
count_ = 0
for i in S:
    if count==A_:
        if i == '-':
            flag = False
    else:
        for j in value:
            if i==j:
                count_ += 1
    count+=1


if count_==len(S)-1 and flag==False:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a=input().split()
A=int(a[0])
B=int(a[1])
S=input()
S=list(S)

t=1

for i in range(A):
 if(S[i]=="-"):
  t=0

if(S[A] != "-"):
  t=0

for i in range(A+B):
 if(i>A):
  if(S[i]=="-"):
   t=0

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

Submission status: Accepted

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

S = input()

Ans = 0

for i in range(A):
	if S[i].isdigit() == False:
		Ans = 1

if S[A] != "-":
	Ans = 1

for i in range(A+1,len(S)):
	if S[i].isdigit() == False:
		Ans = 1
		
if Ans == 0:
	print("Yes")
	
if Ans == 1:
	print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# coding=utf-8

import sys
import re

a, b = sys.stdin.readline().strip().split(" ")
s = sys.stdin.readline().strip()
a = int(a)
b = int(b)
m = re.match(r'(\d+)(-)(\d+)', s)
if m is None:
    print("No")
else:
    if len(m.group(1)) == a and m.group(2) == "-" and len(m.group(3)) == b:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a, b = map(int, raw_input().split())
s = raw_input()
ok = False
if len(s) == (a+b+1):
  n = s.count('-')
  if n == 1:
    x,y = map(str, s.split('-'))
    if len(x) == a:
      if len(y) == b:
        ok = True

if ok:
  print 'Yes'
else:
  print 'No'

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
s=str(input())
ok=True
for i in range(a+b+1):
    if(i==a):
        if(not s[i]=='-'):
            ok=False
    else:
        subs=s[i:i+1]
        if(not subs.isdecimal()):
            ok=False

if(ok==True):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
A,B=[int(i) for i in input().split()]
S=input()
flag = 1
L = A+B+1
if len(S)== L:
    for i in range(L):
        if (i != A and S[i] == '-'):
            flag = 0
        if (i == A and S[i] != '-'):
            flag = 0
else:
    flag = 0
 
if flag == 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

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

Submission status: 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:
n,m = raw_input().split()
ch = ['0','1','2','3','4','5','6','7','8','9']
f = True
s = raw_input()

for i in range(int(n)):
	if s[i] not in ch:
		f = False
if s[int(n)] != '-':
	f = False
for i in range(int(n)+1,len(s)):
	if s[i] not in ch:
		f = False
if len(s) > (int(n)+int(m)+1):
	f = False
if f:
	print "Yes"
else:
	print "No"

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

a, b = sys.stdin.readline().strip().split()
s = sys.stdin.readline().strip()

for i in range(int(a)):
    try:
        if int(s[i]) < 0 or int(s[i]) > 9:
            print("No")
            sys.exit(0)
    except:
        print("No")
        sys.exit(0)
if s[i+1] != "-":
    print("No")
    sys.exit(0)
for j in range(i+2, i+1+int(b)):
    try:
        if int(s[j]) < 0 or int(s[j]) > 9:
            print("No")
            sys.exit(0)
    except:
        print("No")
        sys.exit(0)
print("Yes")

Submission status: Accepted

Solution code:
import sys
A,B=map(int,sys.stdin.readline().split())
S=sys.stdin.readline().strip()
if len(S)==(A+B+1) and S[A]=='-' and all(map(lambda c: '0'<=c<='9',S[:A]+S[A+1:])):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a,b = map(int,raw_input().split(" "))
data = raw_input()
if data.count("-") != 1:
  print "No"
  exit(0)
A,B = data.split("-")
if len(A)==a and len(B)==b:
  print "Yes"
else:
  print "No"

Submission status: Accepted

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

res = 'Yes'
if s[a] != '-':
  res = 'No'
for i,c in enumerate(s):
  if i != a:
    if c == '-':
      res = 'No'
      break

print(res)

Submission status: Accepted

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

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

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

            print("Yes")
            break

        except:
            break


solve()

Submission status: Accepted

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

ok = True
if s[a] != '-':
  ok = False
for c in s[:a] + s[a+1:]:
  if c not in '0123456789':
    ok = False

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

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
s = input()

a, b = all([l.isnumeric() for l in s[:n]]), all([l.isnumeric() for l in s[n+1:]])

if a and b and s[n]=='-':
    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']

flg = 0

for i in range(a):
    if s[i] in nums:
#        print(i)
        pass
    else:
        flg = 1

if s[a] != '-':
    flg = 1

for i in range(a+1,a+b+1):
#    print("b")
#    print(i)
    if s[i] in nums:
        pass
    else:
        flg = 1

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

Submission status: Accepted

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

n=[str(i) for i in range(0,10)]
i=1


for s in ss:
    if s not in n and i!=a+1:
        print("No")
        sys.exit()
    if i==a+1:
        if s !="-":
            print("No")
            sys.exit()
    i+=1

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
a,b=map(int,input().split())
s=input().split("-")
if len(s)==2:
    if len(s[0])==a and len(s[1])==b:
        print("Yes")
        quit()

print("No")

Submission status: Accepted

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

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

    print(slove(a, b, s))

Submission status: Accepted

Solution code:
import re
a, b = map(int, input().split())
s = input()
if re.match(r'[0-9]{' + re.escape(str(a)) + '}-[0-9]{' + re.escape(str(b)) + '}', s):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s = S.split("-")

if len(s) == 2 and A == len(s[0]) and B == len(s[1]):
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
A,B = [int(x) for x in input().split()]
S = input()
if S[:A].isdigit()  and S[A] == "-"  and S[A+1:].isdigit() and len(S) == (A+B+1):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def ss(x):
  if x in ('1','2','3','4','5','6','7','8','9','0'):
    return 0
  else:
    return 1

a,b=[int(i) for i in input().split(' ')]
n=input()
x=0
for i in range(len(n)):
  
  if i<a:
    x+=ss(n[i])
  elif i==a:
    if n[i]!='-':
      x+=1
  elif i<=a+b:
    x+=ss(n[i])
  elif i>a+b:
    x+=1

if x>0:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re

l = input().split()
a = int(l[0])
b = int(l[1])
pc = input()

result = re.fullmatch(r'[0-9]{%d}-[0-9]{%d}' % (a, b), pc)
if result:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
AB = input().split(' ')
S = input().split('-')
if len(S) == 2 and len(S[0]) == int(AB[0]) and len(S[1]) == int(AB[1]):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

ans=True
if len(S) != A+B+1 or S[A] != '-':
    ans=False
else:
    A_str = S[0:A]
    B_str = S[A+1:A+B+1]
    # print(A_str,B_str)
    if ( not A_str.isdigit() ) or ( not B_str.isdigit() ):
        ans=False

ans_str = 'Yes' if ans==True else 'No'
print(ans_str)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import numpy as np

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

s = s.split("-")

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