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

# 関数 solve は，もちろん，問題に応じて書き換える
def solve( lst_a, lst_b,n):
    if n.count("-")!=1:
        answer= "No"
    else:
        N,NN=n.split("-")
        if lst_a == len(N) and lst_b == len(NN):
            answer = "Yes"
        else:
            answer = "No"
    return answer

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    [str_n, str_i] = line1.split(' ')
    line2 = sys.stdin.readline().rstrip()
    return (int(str_n), int(str_i), line2)

def main():
    n, i, s = readQuestion()
    answer = solve(n, i, s)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(n, i, s):
    c = 0
    for i in s:
        if i=='-':
            c+=1
    if  s[n]=='-' and c==1:
        return 'Yes'
    else:
        return 'No'

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    [str_n, str_i] = line1.split(' ')
    line2 = sys.stdin.readline().rstrip()
    return (int(str_n), int(str_i), line2)

def main():
    n, i, s = readQuestion()
    answer = solve(n, i, s)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(a,b,c):
    if len(c) == a+b+1:
        if  c.count("-")!=1:
            return "No"
        elif c[a]==("-"):
            return "Yes"
        else:
            return "No"
    else:
        return "No"
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    [str_n, str_i] = line1.split(' ')
    line2 = sys.stdin.readline().rstrip()
    return (int(str_n), int(str_i), line2)

def main():
    n, i, s = readQuestion()
    answer = solve(n, i, s)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
ans = "Yes"
if S.count('-') >= 2:
	ans = "No"
for i in range(A + B + 1):
	if S[A] != '-':
		ans = "No"
		break
print(ans)

Submission status: Accepted

Solution code:
"""
https://abc084.contest.atcoder.jp/tasks/abc084_b
"""
[a,b]=[int(i) for i in input().split()]
s=input()
c=1
for i in range(len(s)):
    if i==a:
        if s[i]=="-":
            c=c*1
        else:
            c=c*0
    else:
        if s[i]=="-":
            c=c*0
        else:
            c=c*1
if c==0:
    print("No")
else:
    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 = [int(i) for i in input().split()]
S = list(input())
if '-' in S:
    S[A] = '='
    if '-' in S:
        print('No')
    else:
        print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import re

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

regex = '[0-9]{%d}-[0-9]{%d}' %(a,b)
print('Yes' if re.match(regex, s) else 'No')

Submission status: Accepted

Solution code:
import re
A,B=input().split()
S = input()
exp = "\d{" + A + "}-\d{" + B + "}"
regexp = re.compile(exp)
if regexp.match(S):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S = input()
digits = list(map(str,list(range(0,10))))
if S[A] != "-":
        print("No")
        exit()
for i in range(A+B+1):
    if i != A:
        if S[i] not in digits:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

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

    if not (len(S) == A+B+1):
        print("No")
        return
    
    An = S[:A]
    Bn = S[-B:]
    c = S[A:-B]

    if not (An.isdecimal() and Bn.isdecimal() and c=="-"):
        print("No")
        return
    print("Yes")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,raw_input().split())
s=raw_input()
import re
if re.match('\d{%d}-\d{%d}' % (a,b), s):
  print 'Yes'
else:
  print 'No'

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 20 16:39:29 2018

@author: Yuya
"""



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

S = list(input())

S_A = "".join(list(S[0:A]))
S_B = "".join(list(S[A]))
S_C = "".join(list(S[A+1:A+B+1]))

if str.isnumeric(S_A) and S_B == "-" and str.isnumeric(S_C):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if S[A] == "-":
    s = S.split("-")
    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 len(s) == (a+b+1) and all([c != '-' for c in s[:a]+s[a+1:]]) and s[a] == '-':
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
res = False
if len(s.split('-')) == 2:
  sa, sb = s.split('-')
  res = len(sa)==a and len(sb)==b and all(c in '0123456789-' for c in s)
print('Yes' if res else 'No')

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:
def number(c):
    c = str(c)
    ans = 0
    s = "0123456789"
    for i in range(10):
        if c == s[i]:ans = 1
    return ans

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
A,B=map(int,input().split())
S=input()
for i in range(A):
    try:
        T=int(S[i])
    except ValueError:
        print("No")
        exit()
if S[i+1]!="-":
    print("No")
    exit()

for i in range(B):
    try :
        T=int(S[A+1+i])
    except ValueError:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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

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

# 部分文字列を取得して、各条件に合致するか確認
if S[:A].isdigit() and S[A] == "-" and S[A+1:A+1+B].isdigit():
    print("Yes")
else:
    print("No")

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]=='-':
        print("No")
        exit()
    elif i==A and s[i]!='-':
        print("No")
        exit()
    elif A<i<=A+B and s[i]=='-':
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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

for i in range(len(S)):
    if i == A:
        if S[i] != '-':
            res = 'No'
            break
    else:
        if S[i].isdigit() == False:
            res = 'No'

print(res)

Submission status: Accepted

Solution code:
def main():
    A, B = map(int, input().split())
    S = input()
    for a in range(A):
        if S[a]=="-":
            return "No"
    if S[A]!="-":
        return "No"
    for b in range(B):
        if S[A+1+b]=="-":
            return "No"
    return "Yes"

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

Submission status: Accepted

Solution code:
nums = [str(e) for e in range(10)]
a, b = map(int, input().split())
S = input()
flag = True
for idx in range(len(S)):
  if idx == a:
    if S[idx] != '-':
      flag = False
      break
  else:
    if S[idx] not in nums:
      flag = False
      break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
S = input()
def crazy(a,b,S):
    num = "0123456789"
    if S[a] != "-":
        return False
    for i in S[:a]:
        if i not in num:
            return False
    for i in S[a + 1:]:
        if i not in num:
            return False
    return True

if crazy(a,b,S):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
userIn = input().split()
s = input()
a = int(userIn[0])
b = userIn[1]

if s.find('-') == a and s.rfind('-') == a:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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


def judge(S):
    for i in range(len(S)):
        if (i == A and S[i] != "-")or (i != A and S[i] == "-"):
            return "No"
    return "Yes"


print(judge(S))

Submission status: Accepted

Solution code:
A,B=[int(i) for i in input().split()]
S = 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] == "-":
    if "-" in S[:A] or "-" in S[A+1:]:
        print("No")
    else:
        print("Yes")
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:
        if c!='-':
            print('No')
            exit()
    else:
        if c=='-':
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:

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

flag = True
if S[A] != "-":
    flag = False
else:
    try: a = int(S[:A]) + int(S[-B:])
    except ValueError: 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()

if(S.count("-")==1 and (A+B+1==len(S)) and S.find("-")==A):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if N[a] == "-":
    del N[a]
else:
    print("No")
    exit()

if "-" in N:
    print("No")
    exit()
else:
    print("Yes")

Submission status: Accepted

Solution code:
num,num2 = map(int,input().split())
num3 = input()
l = [str(i) for i in range(10)]
count = []
c = 0
for i in num3:
    if(i in l):
        c += 1
    else:
        count.append(c)
        c = 0
count.append(c)
if(num == count[0] and num2 == count[1]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a, b = map(int, input().split(' '))
s = input()
import re
if re.match(r"\d" * a + "-" + r"\d" * b, s):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

if '-' in S[:A]:
    print('No')
    sys.exit()

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

if '-' in S[A + 1:]:
    print('No')
    sys.exit()

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = list(map(int, input().split()))
try:
    x, y = input().split('-')
    print('Yes') if a==len(x) and b==len(y) else print('No')
except:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

if len(s) == a+b+1:
    if s[a] == "-":
        s.pop(a)
        for i in s:
            if i == "-":
                print("No")
                sys.exit()
    else:
        print("No")
        sys.exit()
else:
    print("No")
    sys.exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def valid(a, b, s):
    if len(s) == a + b + 1 and s[a] == '-':
        return all(map(lambda c: c in '0123456789', s[:a] + s[a+1:]))
    else:
        return False


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

Submission status: Accepted

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

if s[:a].isdigit():
    if s[a] == '-':
        if s[a+1:].isdigit():
            print("Yes")
            s = None

if s is not None:
    print("No")

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
D = ["0","1","2","3","4","5","6","7","8","9"]

for k in range(A):
    if S[k] not in D:
        print("No")
        exit(0)

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

for k in range(A+1,A+B+1):
    if S[k] not in D:
        print("No")
        exit(0)
print("Yes")

Submission status: Accepted

Solution code:
import re
a,b=map(int,input().split())
s=input()
if re.match('[0-9]'*a + '\-' + '[0-9]'*b, s) != None:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

sl = s.split('-')
if len(sl) != 2:
    print('No')
elif ( sl[0].isdecimal() and len(sl[0]) == a ) and ( sl[1].isdecimal() and len(sl[1]) == b):
   print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import re
ab = list(map(int, input().split()))
S = input()
if S[ab[0]] != '-':
    print("No")
    exit()

s = S.split('-')
if len(s) > 2:
    print("No")
    exit()

for i in range(2):
    if not ( len(s[i]) == ab[i] and re.compile(r'\d').match(s[i]) ):
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if (s.count('-') == 1) and (s.index('-') == a) and s[:a].isdigit() and s[-b:].isdigit():
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a, b = map(int,input().split())
s=list(input())
f=0
for i in range(0,a):
   # print(s[i])
    if(s[i]<'0' or s[i]>'9'):
        f=1
        break

if(s[a]!='-'):
    f=1
               
for i in range(a+1,a+1+b):
   # print(s[i])
    if(s[i]<'0' or s[i]>'9'):
        f=1
        break
if(f==0):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
s1=[]
for k in s:
    s1.append(k)
x=0
if s1[a+1-1]=='-':
    s1.remove(s1[a])
    for i in s1:
        if i not in ('0','1','2','3','4','5','6','7','8','9'):
            x=0
            break
        else:
            x=1
else:
    x=0
if x==0:
    print('No')
elif x==1:
    print('Yes')

Submission status: Accepted

Solution code:
import math
import sys
import re
def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

a = arr_data[0][0]
b = arr_data[0][1]
s = arr_data[1][0]

#pattern="^[0-9]{3}-[0-9]{4}$"

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

#print(pattern)

if(re.search(pattern,s)):
    
    print("Yes")

else:
    
    print("No")

Submission status: Accepted

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

res = 'Yes'
if S[A] != '-' or len(S) != A+B+1:
    res = 'No'
#     print('0')
else:
    for i in range(A):
        if not S[i] in '1234567890':
#             print('1')
            res = 'No'
            break
    for i in range(B):
        if not S[A+i+1] in '1234567890':
#             print('2')
            res = 'No'
            break
print(res)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

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

a,b = na()
s = ns()
flag = 1
if s[a] == "-":
    for i in s[:a]:
        if i == "-":
            flag = 0
            break
    if flag:
        for i in s[a+1:]:
            if i == "-":
                flag = 0
                break
else:
    flag = 0
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(S)):
    if i+1 <= A and S[i]=='-':
        print('No')
        break
    elif i+1 == A+1 and S[i]!='-':
        print('No')
        break
    elif A+1 < i+1 and i+1 <= A+B+1:
        if S[i]=='-':
            print('No')
            break

else:
    print('Yes')

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
tr, fal = "Yes", "No"

def judge_post_code():
    if len(S) != A + B + 1:
        return fal
    if S[A] != "-":
        return fal
    for i in S[:A]:
        if not i in "0123456789":
            return fal
    for i in S[A+1:]:
        if not i in "0123456789":
            return fal
    return tr

print(judge_post_code())

Submission status: Accepted

Solution code:
a,b = (int(i) for i in 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()

arr=S.split("-")

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

Submission status: Accepted

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

flag=True
if S[A]!='-':
    flag=False
a=S[:A]
b=S[A+1:]
if not(a.isdigit() and b.isdigit()):
    flag=False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n,m=map(int,input().split());s=input();print('No'if s[n]!='-'or'-'in s[:n]+s[-m:]else'Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    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")
            exit(0)
    print ("No")

Submission status: Accepted

Solution code:
line1 = input()
post1, post2 = map(int, line1.split())

postal_list = postal_code = input().split("-")

if len(postal_list) == 2:
    if post1 == len(postal_list[0]) and post2 == len(postal_list[1]):
        print ("Yes")
    else:
        print ("No")
else:
    print ("No")

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    import re

    A, B = list(map(str, input().split()))
    S = str(input())

    text = r'\d{' + A + '}\-\d{' + B + '}'
    result = re.match(text, S)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
try :
    int(S[:A])
    int(S[B:])
except ValueError:
    print("No")
    exit()
if S[A] == "-":
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if re.match(r'[0-9]{%s}-[0-9]{%s}' % (A,B),S):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

reString=r"^\d{"+A+"}-\d{"+B+"}$"
reCompiled=re.compile(reString)
if reCompiled.match(S):
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
A, B = map(int, input().rstrip().split())
S = input()
n = [str(n) for n in range(10)]
fulfill = 1
for s in S[:A]:
    if s not in n:
        print("No")
        fulfill = 0
        break
if fulfill:
    if S[A] != "-":
        print("No")
        fulfill = 0
if fulfill:
    for s in S[A + 1:]:
        if s not in n:
            print("No")
            fulfill = 0
            break
if fulfill:
    print("Yes")

Submission status: Accepted

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

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

if not S[:A].isdigit():
    print("No")
    exit()

if not S[A+1:].isdigit():
    print("No")
    exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, raw_input().split())
s = raw_input().split('-')

if(len(s)==2 and len(s[0])==a):
  print 'Yes'
else:
  print 'No'

Submission status: Accepted

Solution code:
import re
a,b = input().split()
ans = ["No", "Yes"]
print( ans[  re.match( '[0-9]{' + a + '}-[0-9]{' + b  + '}'  , input()) != None  ])

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(A+B+1):
	if i == A:
		if S[i] != '-':
			print("No")
			exit(0)
	else:
		if S[i] not in numbers:
			print("No")
			exit(0)

print("Yes")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
g = list(map(int,input().split()))
S = str(input())
 
if ((S[:g[0]]+S[g[0]+1:]).isdigit()) &  (S[g[0]]=="-"):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

import sys

def main():
    a, b = map(int, sys.stdin.readline().split())
    s = sys.stdin.readline().strip()

    for i, c in enumerate(s):
        if i != a:
            if c.isdigit() == True and 0 <= int(c) <= 9:
                continue
        elif c == '-':
            continue
        break
    else:
        print('Yes')
        sys.exit()

    print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
A,B = map(int,input().split(" "))
S = list(input())
judge=True
for i in range(len(S)):
    if i == A:
        if S[i] == "-":
            pass
        else:
            judge = False
    else:
        try:
            int(S[i])
        except:
            judge =False
if judge:
    print("Yes")
else:
    print("No")