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().split('-')
print('Yes' if len(s[0])==a and len(s[1])==b else 'No')

Submission status: Accepted

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

    for idx in range(len(S)):
        if idx == A:
            if S[idx] != "-":
                print("No")
                return

        else:
            if not S[idx].isdigit():
                print("No")
                return

    print("Yes")

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
flag = True
if(len(S) != A + B + 1 or S[A] != '-'):
    print('No')
    flag = False
if(flag):
    for i in range(len(S)):
        if(i == A):
            continue
        if(S[i] < '0' or S[i] > '9'):
            print('No')
            flag = False
            break
if(flag):
    print('Yes')

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = input()
flag = True
for i in range(a+b+1):
    if i == a:
        if s[i] != "-":
            flag = False
            break
    else:
        if not (s[i] in list(map(str,range(10))) ):
            flag = False
            break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
from collections import Counter

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

count = Counter(S)

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

Submission status: Accepted

Solution code:
def is_int(numstr):
    return all(map(lambda c: c in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], numstr))


def main():
    a, b = map(int, input().split())
    s = input()
    haifun = s[a]
    mae = s[:a]
    ushiro = s[-b:]
    if is_int(mae) and haifun == "-" and is_int(ushiro):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

import sys

a, b = [int(e) for e in raw_input().split()]
s = raw_input().split()[0]

sa = s[:a]
sh = s[a:a+1]
sb = s[a+1:]

if len(sa) == a:
    if  sa.isdigit():
        if sh == '-':
            if len(sb) == b:
                if sb.isdigit():
                    sys.stdout.write('Yes\n')
                    sys.stdout.flush()
                    sys.exit(0)

sys.stdout.write('No\n')
sys.stdout.flush()

Submission status: Accepted

Solution code:
#前後の桁数
front,back = map(int,input().split())
#テスト対象
test_code = list(input())
#数列
seikai = ["0","1","2","3","4","5","6","7","8","9"]
flag = True
 
if test_code[front] == "-":
    for x in range(front + back + 1):
        if x != front:
            if (test_code[x] in seikai) is False:
                flag = False
                break
else:
    flag = False
 
if flag == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

result = ""
if len(s)!=a + b + 1:
    result = "No"
elif s[a]!="-":
    result = "No"
else:
    for i in range(len(s)):
        if s[i] == "-" and i != a:
            result = "No"
        if s[i] != "-" and int(s[i]) not in range(0, 10):
            result = "No"
    if result !="No":
        result = "Yes"
print(result)

Submission status: Accepted

Solution code:
# -- coding: utf-8 --
import re
a, b = map(int, input().split(' '))
pc = input()
pattern = '^\d{{{0}}}-\d{{{1}}}$'.format(a, b)
if re.match(r'{0}'.format(pattern), pc):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc084/tasks/abc084_b

"""
import sys
from sys import stdin
import re
input = stdin.readline


def solve(A, B, S):
    result = 'No'
    pattern = r'^(\d{' + str(A) + '})-(\d{' + str(B) + '})$'
    m = re.search(pattern, S)
    if m:
        result = 'Yes'
    return result


def main(args):
    A, B = map(int, input().split())
    S = input().strip('\n')
    # A, B = 3, 4
    # S = '269-6650'
    ans = solve(A, B, S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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:
import re

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

S = input()

pattern = re.compile(r'\d{%d}-\d{%d}' % (A, B))

if re.match(pattern, S):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a,b = map(int,raw_input().split())
valid = True
s = raw_input()
for ind in range(len(s)):
        if ind == a:
            if s[ind] != "-":
                valid = False
        else:
            if s[ind].isalpha() or s[ind] == "-":
                valid = False        
if valid: print "Yes"
else: print "No"

Submission status: Accepted

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

def solve(a,b,s):
    # print(s[a])
    if s[a] != '-':
        return 'No'

    cstring = s[:a] + s[a+1:a+b+1]
    # print(cstring)
    for p in range(len(cstring)):
        if cstring[p].isdigit() != True:
            return 'No'
    return 'Yes'

print(solve(a,b,s))

Submission status: Accepted

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

flag = True

for i in range(a+b):
    if i == a and not(s[i] == '-'):
        flag = False

    if i is not a and s[i] == '-':
        flag = False


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

Submission status: Accepted

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

if s[A] == "-":
    s[A] = "1"
else:
    s[A] = "x"

S = "".join(s)
if S.isdigit():
    print("Yes")
else:
    print("No")

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:
A, B = map(int, input().split(" "))
S = input()

if S.count("-") != 1:
    print("No")
else:
    z, k = S.split("-")
    
    if len(z) == A and len(k) == B:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
#前後の桁数
front,back = map(int,input().split())
#テスト対象
test_code = list(input())
#数列
seikai = ["0","1","2","3","4","5","6","7","8","9"]
flag = True

if test_code[front] == "-":
    for x in range(front + back + 1):
        if x != front:
            if (test_code[x] in seikai) is False:
                flag = False
                break
else:
    flag = False

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

Submission status: Accepted

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

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

Submission status: Accepted

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

T = list(S.strip().split('-'))

if len(T[0])==A and len(T[1])==B:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split(' '))
S = input()
N=0
if S[A] != '-':
    N=1
else:
    i=0
    while i < A:
        if S[i] in ['0','1','2','3','4','5','6','7','8','9']:
            i+=1
        else:
            N = 1
            break
    i+= 1
    while i < (A+B+1):
        if S[i] in ['0','1','2','3','4','5','6','7','8','9']:
            i+=1
        else:
            N = 1
            break
if N == 1:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

ans = False
if "-" in s:
    if s.count("-") == 1:
        sa, sb = s.split("-")
        if len(sa) == a and len(sb) == b:
            for i in sa+sb:
                if not i.isdigit():
                    break
            else:   
                ans = True
if ans:
    print("Yes")
else:    
    print("No")

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
s=input()
if '-' in s:
    c=s.split('-')
    if len(c[0])==A and len(c[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:
    print("No")
else:
    z, k = S.split("-")
    
    if (len(z) == A) and (len(k) == B):
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

def validate(a, b, s):
    pattern = "\\d{%d}-\\d{%d}"%(a, b)
    #print(pattern)
    m = re.match(pattern, s)
    return m is not None



if __name__ == "__main__":
    a, b = map(int, input().split())
    s = input()
    if validate(a, b, s):
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
S = input()
result = "Yes"
if(A<=0 or B<=0 or A>5 or B>5 or S.count("-") != 1):
	result = "No"
else:
	T = S.split("-")
	if(not T[0].isdigit() or not T[1].isdigit()
	or len(T[0]) != A or len(T[1]) != B):
		result ="No"
print(result)

Submission status: Accepted

Solution code:
input_list = []
for i in range(2):
    input_list.append(input().split())
A = int(input_list[0][0])
B = int(input_list[0][1])
S = input_list[1][0]

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# ABC084  B - Postal Code  

# Request user input from stdin 
a,b = map(int,input().split())
s = input()

def isThereHyphen():
  rslt = False
   
  if s[a] == "-":
    firstStr = (s.split("-"))[0]
    secondStr = (s.split("-"))[1]
    if((firstStr.isdigit() == True) and (secondStr.isdigit() == True)):
      rslt = True

  return rslt

def main():
  rslt = isThereHyphen()

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

# main logic
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = [int(i) for i in input().split()]
yubin = input()
answer = ''

for i in range(a):
    if yubin[i] == '-':
        answer = 'No'

if yubin[a] != '-':
    answer = 'No'

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

if answer == 'No':
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
A, B = list(map(int, input().split()))
S = list(map(str, 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 re

A, B = raw_input().split()
s = raw_input()

print "Yes" if re.match("\d{"+A+"}-\d{"+B+"}", s) else "No"

Submission status: Accepted

Solution code:
import re

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

def main():
    pattern = r"[0-9]{{{0}}}-[0-9]{{{1}}}".format(A, B)
    ans = "Yes" if re.match(pattern, S) else "No"
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np
import pdb


def main():
    AB = raw_input().split(' ')
    A = int(AB[0])
    B = int(AB[1])
    S = np.array(list(raw_input()))
    if checkpostal(S,A,B):
        print 'Yes'
    else:
        print 'No'

def checkpostal(S, A, B):
    integers = [str(k) for k in range(10)]
    checkpasses = True
    if len(S) !=  A + B + 1:
        return False

    for k in range(len(S)):
        if k == A:
            mypass = (S[k] == '-')
            checkpasses = checkpasses and mypass
        else:
            mypass = S[k] in integers
            checkpasses = checkpasses and mypass

    return checkpasses

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import re
A,B=map(int,input().split())
print(["Yes","No"][re.match("\d{{{}}}-\d{{{}}}\Z".format(A,B),input())is None])

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = input()
result = "Yes"
for i,s in enumerate(S):
    if i < A or A < i:
        if(s == '-'): 
            result =  "No"
            break
    else:
        if(s != '-'):
            result =  "No"
            break
print(result)

Submission status: Accepted

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

    S = S.split('-')
    if len(S) != 2:
        print('No')
        exit()

    a = S[0]
    b = S[1]

    if len(a) == A:
        if len(b) == B:
            print('Yes')
            exit()

    print('No')

Submission status: Accepted

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

f = S[:int(A)]
s = S[int(A)+1:]

if S[int(A)] == "-":
    if f.isdigit() and s.isdigit():
        ans = "Yes"
    else:
        ans = "No"
else:
    ans = "No"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
A, B = [x for x in input().split()]
print('Yes' if re.match('^[0-9]{' + A + '}-[0-9]{' + B + '}$', input()) else 'No')

Submission status: Accepted

Solution code:
import re

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

match = re.match('^[0-9]{' + str(A) + '}-[0-9]{' + str(B) + '}$', S)

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

Submission status: Accepted

Solution code:
#A, Bの読みとり
num = input()
Num = num.split()
a = int(Num[0])
b = int(Num[1])

#郵便番号の読みとり
ad = input()
A = ad[:a]
s = ad[a]
B = ad[a+1:]

Alist = list(A)
Blist = list(B)

i = 0
j = 0
ca = "f"
cb = "f"
for i in range(10):
    for j in range(a):
        #print(i,Alist[j])
        if str(i) == Alist[j]:
            ca = "t"
            break
    if ca == "t":
        break
for i in range(10):
    for j in range(b):
        #print(i,Blist[j])
        if str(i) == Blist[j]:
            cb = "t"
            break
    if cb == "t":
        break

if ad[a] == "-" and ca == "t" and cb == "t":
    Al = len(A)
    Bl = len(B) 

    if a == Al and b == Bl :
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

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

    for i in s[0:a]:
        if '0' > i or i > '9':
            print("No")
            return
    if s[a] != '-':
        print("No")
        return
    for i in s[a+1:a+b+1]:
        if '0' > i or i > '9':
            print("No")
            return
    print("Yes")
    return

solve()

Submission status: Accepted

Solution code:
import re

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

regex = '[0-9]{'+str(A)+'}-[0-9]{'+str(B)+'}'
if( re.compile(regex).match(S) ):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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


if s[a] == '-' and a + b + 1 == len(s):
    for i in range(len(s)):
        asc = ord(s[i])
        if a == i:
            continue
        if asc < 48 or asc > 57:
            print "No"
            sys.exit()
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:


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

ok = True

if s[a] != '-':
    ok = False

ok = ok and s[0:a].isdigit() and s[a+1:].isdigit()

print(("No", "Yes")[ok])

Submission status: Accepted

Solution code:
def solve():
	A, B = list(map(int, input().split()))
	S = input()
	if len(S) != (A+B+1) or S[A] != "-" or not S[:A].isdigit() or not S[A+1:].isdigit():
		print("No")
		return
	else:
		print("Yes")
	
solve()

Submission status: Accepted

Solution code:
import re

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

if re.match(r"\d{%d}-\d{%d}"%(A, B), S):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def suuji(S):
    for i in range(len(S)):
        if S[i]=="-":
            return False
    return True

def func(S,a,b):
    if S[a]=="-":
        S.pop(a)
        if suuji(S) and len(S)==a+b:
            return "Yes"
    return "No"


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

S=list(input())

print(func(S,a,b))

Submission status: Accepted

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

sliceA = S[0:A]
sliceB = S[A+1:A+B+1]

if sliceA.isdigit() and sliceB.isdigit() and S.find("-") == A and len(sliceA) == A and len(sliceB) == B:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/python

# AtCoder Beginner Contest 084
# B: Postal Code

import sys

A, B = [int(w) for w in sys.stdin.readline().split()]
S = sys.stdin.readline().strip()

answer = True
answer = answer and (len(S) == A + B + 1)
answer = answer and (S[A] == '-')
answer = answer and all(c != '-' for c in S[:A] + S[A + 1:])

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

Submission status: Accepted

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

ret=True
for i in range(0,a):
  if not (s[i]=='0' or s[i]=='1' or s[i]=='2' or s[i]=='3' or s[i]=='4' or s[i]=='5' or s[i]=='6' or s[i]=='7' or s[i]=='8' or s[i]=='9'):
    ret=False
if not s[a]=='-':
  ret=False
for i in range(a+1,len(s)):
  if not (s[i]=='0' or s[i]=='1' or s[i]=='2' or s[i]=='3' or s[i]=='4' or s[i]=='5' or s[i]=='6' or s[i]=='7' or s[i]=='8' or s[i]=='9'):
    ret=False

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

Submission status: Accepted

Solution code:
import re
A,B = [int(i) for i in input().split()]
S = input()
count = 0
for i in range(A + B + 1) :
    if (S[A] != '-'):
        break
    elif (re.match("[0-9]",S[i])):
        count+=1
if count == (A + B):
    print('Yes')
else :
    print('No')

Submission status: Accepted

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

def check(a, b, s):
    if not len(s) == 2:
        return "No"

    former, latter = s[0], s[1]
    if not(len(former) == a and len(latter) == b):
        return "No"

    try:
        num_former = int(former)
        num_latter = int(latter)
        return "Yes"
    except ValueError:
        return "No"

print(check(a, b, s))

Submission status: Accepted

Solution code:
A,B=map(int, input().split())
S=input()
c=S.count('-')
if c==0 or 2<=c:
  print('No')
elif S[A]!='-':
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
from pprint import pprint as pp
def GI(): return int(raw_input())
def GIS(): return map(int, raw_input().split())

def main():
  A, B = GIS()
  S = raw_input()
  print('Yes' if S[A] == '-' and all(map(str.isdigit, (S[:A], S[A+1:]))) else 'No')

main()

Submission status: Accepted

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

    if len(s) == a+b+1 and  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().split('-')
print(['No','Yes'][(len(s[0])==a) and (len(s[1])==b)])

Submission status: Accepted

Solution code:
strnum = [str(i) for i in range(10)]

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

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:
def main():
    a, b = map(int, input().split())
    address = input()

    flag = True
    for i in range(len(address)):
        if i == a:
            if address[i] != '-':
                flag = False
                break
            else:
                continue
        try:
            tmp = int(address[i])
        except ValueError:
            flag = False
            break

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

# 先頭A文字が数字か？,A+1文字目がハイフンか？,残りB文字が数字か？
cond = [True,True,True]
for i in range(A):
  if S[i] not in '0123456789':
    cond[0]=False
if S[A]!='-':
  cond[1]=False
for i in range(A+1,A+B+1):
  if S[i] not in '0123456789':
    cond[2]=False

if all(cond):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = (len(S) == A+B+1)
for i,c in enumerate(S):
  if i == A:
    ans &= (c == '-')
  else:
    ans &= ('0' <= c <= '9')

print(['No', 'Yes'][ans])

Submission status: Accepted

Solution code:

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

try:
    int(s[:a])
    int(s[a+1])

except Exception:
    print('No')
    exit()

if s[a] == '-':
    print('Yes')

else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ok = len(s) == a + b + 1 and s[a] == '-' and s[:a].isdigit() and s[a+1:].isdigit()

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

Submission status: Accepted

Solution code:
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_I(): return map(int, stdin)
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))

##### main #####



def main():
	a,b = LI()
	s = input().split('-')

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


if __name__ == '__main__':
	main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import re
z=re.split('\s',input())
s=input()
print("Yes") if re.match("\d{"+z[0]+"}-\d{"+z[1]+"}",s) else print("No")

Submission status: Accepted

Solution code:
# coding: utf-8

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

def check(arg):
    flag = True
    for i in arg:
        if i in "0123456789":
            flag = True
        else:
            flag = False
    return flag

# calc
cut_a = s[:a]
cut_b = s[a:a+1]
cut_c = s[a+1:a+1+b]

# output
if check(cut_a) and cut_b == "-" and check(cut_c):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a=(input()).split(' ')
S=input()

if S.count('-')!=1:
    print('No')
else:
    S=S.split('-')
    print('Yes' if (len(S[0])==(int)(a[0]) and len(S[1])==(int)(a[1]))else 'No')

Submission status: Accepted

Solution code:
import sys
from builtins import map
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache, reduce
from operator import xor
from heapq import heappush, heappop
INF = float("inf")
sys.setrecursionlimit(10**7)

# 4近傍（右, 下, 左, 上）
dy4, dx4 = [0, -1, 0, 1], [1, 0, -1, 0]


def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W


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

    ans = "Yes"
    for i in range(A):
        if not S[i].isdigit():
            ans = "No"
    if S[A] != "-":
        ans = "No"

    for i in range(A + 1, A + B + 1):
        if not S[i].isdigit():
            ans = "No"
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import re

A, B = input().split()
postal_code = input()

def func(str1, str2, pcode):
    if pcode[int(str1)] != '-':
        return print('No')
    else:
        str_A, str_B = pcode[0:int(str1):], pcode[int(str1)+1::]

        if not re.match('[0-9]{1,}$', str_A):
            return print('No')
    
        if not re.match('[0-9]{1,}$', str_B):
            return print('No')
    
    return print('Yes')


if __name__ == '__main__':
    func(A, B, postal_code)

Submission status: Accepted

Solution code:
a, b = list(map(int,input().split()))
s = input()
from collections import Counter
c = Counter(s)
if (c["-"] == 1) & (s.find("-") == a):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

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

print("Yes")

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
from collections import Counter
a, b = map(int, input().split())
s = list(input())
c = Counter(s)
if len(s) == a+b+1:
    if c['-'] == 1 and s[a] == '-':
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

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


if (len(S) == (A+B+1)) and (S[A] == '-') and (S.count('-') == 1) and len(re.findall('[0-9]', S)) == (A+B):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if len(S) != A+B+1 or S[A] != '-':
    print("No")
else:
    try:
        a = int(S[0:A])
        b = int(S[A+1:A+B+1])
        print("Yes")
    except:
        print("No")

Submission status: Accepted

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

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:
#!/usr/bin/env python3
A, B = map(int, input().split())
S = input().split('-')
print('Yes' if (len(S) == 2 and len(S[0]) == A and len(S[1]) == B) else 'No')

Submission status: Accepted

Solution code:
l = map(int, raw_input().split())
k = raw_input()
listed = list(k)
if (len(k) == (l[0] + l[1] + 1)) and (listed[l[0]] == "-"):
    if (str("".join(listed[0:l[0]])).isdigit() == True) and (str("".join(listed[l[0]+1:len(listed)])).isdigit() == True):
        print "Yes"
        exit()
    print "No"
else:
    print "No"

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=str(input())
haihun=s[a]
number=s[:a]+s[a+1:]

ans=set(list(number))

if haihun=='-' and ans <= set(list('1234567890')):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
try:
    first, second = s.split("-")
    if len(first) == a and len(second) == b:
        print("Yes")
    else:  
        print("No")
except:
    print("No")

Submission status: Accepted

Solution code:
a,b=map(int,raw_input().split())
y=raw_input()
for i in range(len(y)):
	if i==a and y[i]!='-':
		print "No"
		exit(0)
	if i!=a and y[i] not in '0123456789':
		print "No"
		exit(0)
print "Yes"

Submission status: Accepted

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

import math
import sys

A,B = input().split(" ")
s = str(input())

s_sp = s.split("-")

if (len(s_sp) != 2):
    print("No")
    sys.exit()

if (len(s_sp[0]) != int(A)) | (len(s_sp[1]) != int(B)):
    print("No")
    sys.exit()

if ((s_sp[0].isdigit()) & (s_sp[1].isdigit())):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import re
a, b = map(str, input().split())
s = input()

pattern = "[0-9]{" + a + "}-[0-9]{" + b + "}"

if re.match(pattern, s):
    print("Yes")
else:
    print("No")