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 = [int(x) for x in input().split()]
num = '0123456789'
S = input()
flg = True
for i in range(len(S)):
  if i == a:
    if not S[i] == '-':
      flg = False
  else:
    if not S[i] in num:
      flg = False
print('Yes' if flg else 'No')

Submission status: Accepted

Solution code:
import math
import itertools
import statistics
#n = int(input())
a, b = list(map(int, input().split()))
s = input()
for i in range(len(s)):
    if i==a and s[i]!="-":
        print("No")
        exit()
    if i!=a and (s[i]!="0" and s[i]!="1" and s[i]!="2" and s[i]!="3" and s[i]!="4"
    and s[i]!="5" and s[i]!="6" and s[i]!="7" and s[i]!="8" and s[i]!="9"):
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
#ABC084

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def Postal_Code(a , b , s):

    ans = "No"

    if s[:a].isdecimal() and s[a+1:].isdecimal() and s[a] == '-':
        ans = "Yes"

    return ans

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

    if s[a:a+1] != '-':
        print('No')
    elif len(s) > a + b + 1:
        print('No')
    else:
        s2 = s[:a] + s[a+1:a+b+1]
        if  all([48 <= ord(str(c)) <= 57  for c in s2]):
            print('Yes')
        else:
            print('No')

main()

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=input()
cnt=0
for i in range(len(S)):
    if(S[i]=='-'):
        cnt+=1
if(cnt>1 or cnt<1):
    print("No")
    exit()
Sl,Sr=S.split('-')
if(len(Sl)==A and len(Sr)==B):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

code = input()

def isInt(c):
    try:
        int(c)
        return True
    except ValueError:
        return False

for i, c in enumerate(code):
    if i == a:
        if c != '-':
            print('No')
            exit()
    else:
        if not isInt(c):
            print('No')
            exit()

print('Yes')

Submission status: Accepted

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

sa =S[:a]
sb =S[a+1:]

x = S[a]

if x != "-":
  print("No")
  exit()
  
  
if sa.isdigit() and sb.isdigit():
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#084_B
a,b=map(int,input().split())
s=input()
flg=True
for i in range(a+b+1):
    if i==a:
        if s[i]!='-':
            flg=False
    else:
        if s[i] not in '0123456789':
            flg=False

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = list(input())
c = [str(i) for i in range(10)]

for i in range(a+b+1):
    if a == i:
        if s[i] == "-": 
            continue
        else:
            print("No")
            break
    if s[i] not in c:
        print("No")
        break
else:
    print("Yes")

Submission status: Accepted

Solution code:
def main():
    A, B = map(int, input().split())
    S = list(input())
    ans = "Yes"
    for i, c in enumerate(S):
        if i < A and c == "-":
            ans = "No"
            break
        elif i == A and c != "-":
            ans = "No"
            break
        elif i > A and c == "-":
            ans = "No"
            break
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

S = S.replace("-","",1)
if S.isdecimal() :
    print("Yes")
else :
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if S.count("-") == 1:
  s1,s2=S.rstrip().split("-")
  print( "Yes" if len(s1)==A and len(s2)==B else "No" )
else:
  print("No")

Submission status: Accepted

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

if s[a]!="-":
    print("No")
    exit()


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

Submission status: Accepted

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

Submission status: Accepted

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

if len(content) == a + b + 1:
    A = content[:a]
    B = content[-b:]
    hyphn = content[a]
    if A.isdecimal() and B.isdecimal() and hyphn == '-':
        print('Yes')
    else :
        print('No')

Submission status: Accepted

Solution code:
import re
a, b = map(str, input().split())
s = input()
ptn = '^\d{' + a + '}-\d{' + b + '}'
if re.search(ptn, s):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N_before, N_after = map(int, input().split())
S = input()
judge = 'Yes'

if (S[: N_before].count('-') >= 1):
    judge = 'No'

if (S[N_before] != '-'):
    judge = 'No'

if (S[N_before + 1 :].count('-') >= 1):
    judge = 'No'

print(judge)

Submission status: Accepted

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

if S[a]=='-':
    if not '-' in S[:a] and not '-' in S[a+1:]:
        ans=True
        
print("Yes" if ans else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
flag = False
for i in range(len(S)):
    if i == A:
        if S[i]=="-":
            flag = True
    else:
        if S[i]=="-":
            flag = False
            break
print("Yes")if flag else print("No")

Submission status: Accepted

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

ans = "No"
if (len(a_list) == 2) and (b_list.count("-") == 1) and (len(a_list[0]) == a) and (len(a_list[1]) == b):
  ans = "Yes"
  
print(ans)

Submission status: Accepted

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

flag = True
l= '0123456789'
for s in S[:A]+S[A+1:]:
  if s not in l:
    flag = False
print(['No','Yes'][S[A] == '-' and flag])

Submission status: Accepted

Solution code:
#n = int(input())
a,b = map(int,input().split())
#a_L = list(map(int,input().split()))

s = list(input())
if s[a] != "-":
    print("No")
    exit()

s.pop(a)
try:
    a = list(map(int,s))
    #print(a)
except:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

A,B=MI()
S=input()

f=1
for i in range(A+B+1):
    if i==A:
        if S[i]!="-":
            f=0
    else:
        if S[i]=="-":
            f=0
            
if f==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:
    if not '-' in s[:a]:
        if not '-' in s[a+1:]:
            if s[a]=='-':
                print('Yes')
                exit()
print('No')

Submission status: Accepted

Solution code:
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()
print('No')

Submission status: Accepted

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

import re

if re.match("^[0-9]{"+str(A)+"}-[0-9]{"+str(B)+"}$",S):
  ans = 'Yes'
else:
  ans = 'No'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

del S[A]
for s in S:
    if s not in l:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

s=input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
ans = "No"
num = [i for i in range(10)]

if len(s) == a+b+1:
    if s[a] == "-":
        s = list(s)
        s.pop(a)
        s = "".join(s)
        if s.isdigit():
            ans = "Yes"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = ""
ss = ""
for i in range(len(s)):
    if i == a:
        ss += " "
    else:
        ss += s[i]    

if (len(s) != a+b+1) or (s[a] != "-") or ("-" in ss):
    ans = "No"
else:
    ans = "Yes"

print(ans)

Submission status: Accepted

Solution code:
A, B = [int(i) for i in input().split()]
S = input()
for i in range(A+B+1):
    if i==A:
        if S[i]=='-':
            continue
        else:
            print("No")
            quit()
    else:
        try:
            int(S[i])
        except:
            print("No")
            quit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

A = []
s = input()
A = s.split("-")


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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
ans = "Yes"
for i, s_i in enumerate(s):
    if i == a:
        if s_i == "-":
            pass
        else:
            ans = "No"
            break
    else:
        if s_i != "-":
            pass
        else:
            ans = "No"
            break
print(ans)

Submission status: Accepted

Solution code:
def main():
    A, B = map(int, input().split())
    postcode = input()
    answer = False
    if postcode.count("-") == 1:
        if postcode[A] == "-" and postcode[:A].isdecimal() and postcode[A + 1:].isdecimal():
            answer = True
    print("Yes" if answer else "No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

tmp1=s[:a]
tmp2=s[a]
tmp3=s[a+1:]

if all([tmp1[i]!='-' for i in range(len(tmp1))])==True and tmp2=='-' and all([tmp3[i]!='-' for i in range(len(tmp3))])==True:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

ans = 'Yes'
for i in range(a):
    if s[i] == '-':
        ans = 'No'
if s[a] != '-':
    ans = 'No'
for i in range(b):
    if s[a+i+1] == '-':
        ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
t=s[:a]+s[a+1:]
bl=(s[a]=='-') and (t.find('-')==-1)
print('Yes' if bl else '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"]
for i in range(a+b+1):
    if i == a:
        if s[a] != "-":
            print("No")
            quit()
    else:
        if not s[i] in nums:
            print("No")
            quit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

flag = True
for i in range(a):
    if s[i] == '-':
        flag = False
if s[a] != '-':
    flag = False
for i in range(a + 1, a + b + 1):
    if s[i] == '-':
        flag = False

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

"""
number = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
flag = True
for i in range(a):
    if s[i] not in number:
        flag = False
        #print("A")
if s[a] != '-':
    flag = False
    #print("B")
for i in range(a + 1, a + b + 1):
    if s[i] not in number:
        flag = False
        #print("C")

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

Submission status: Accepted

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

number = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
flag = True
for i in range(a):
    if s[i] not in number:
        flag = False
        #print("A")
if s[a] != '-':
    flag = False
    #print("B")
for i in range(a + 1, a + b + 1):
    if s[i] not in number:
        flag = False
        #print("C")

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

Submission status: Accepted

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

Submission status: Accepted

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


def main():
    A, B = map(int, input().split())
    S = input()
    N = S[:A] + S[A + 1:]

    print("Yes" if S[A] == "-" and N.isdigit() else "No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

if S[0:A].count('-') > 0 or S[A+1:A+B].count('-') > 0 or S[A]!='-':
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

for i, s in enumerate(S):
    if i == A:
        if s != '-':
            ans = 'No'
    if i != A:
        if s == '-':
            ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=input()
l=S.split("-")
if (len(l[0])==A)and(len(l[1])==B):
    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,_ = map(int,input().split())
s = input()
print('YNeos'[1-all([s[:a].isdigit(),s[a]=='-',s[a+1:].isdigit()])::2])

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
l = len(s)
ok = 1

for i in range(a):
    if s[i] == '-':
        ok = 0
if s[a] != '-':
    ok = 0
for i in range(a+1, l):
    if s[i] == '-':
        ok = 0
if ok == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=str(input())
T=sorted(S[:])
#print(*T)
p=0
if (A+B+1)!=len(S):
  print("No")
else:
  if S[A]=="-":
    for i in range(1,len(S)):
      if 48<=ord(T[i])<=57:
        #print(i,T[i],ord(T[i]))
        p=1
      else:
        p=0
        break
    #print(p)
    print("Yes" if p!=0 else "No")
  else:
    print("No")

Submission status: Accepted

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

flag=True
count=0

for i in range(len(s)):
    if s[i]=='-':
        count+=1
        if i!=a:
            flag=False
            break

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

Submission status: Accepted

Solution code:
import re

A,B = map(int, input().split())
S = str(input())
ma = '^[0-9]{'+str(A)+'}-[0-9]{'+str(B)+'}$'
pattern = re.compile(ma)
m=pattern.match(S)
#print(m)
if m is not None:
    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+b+1):
    if i==a and s[i]=="-":
        ans+=1
    elif i!=a and s[i].isdecimal()==True:
        ans+=1
if ans==a+b+1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

flag = False
if(s[a] == '-'):
    flag = True

for i in range(a + b + 1):
    if(i != a and flag):
        if(not s[i].isdecimal()):
            flag = False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = input()
flag = True
for i in range(len(S)):
    if i == (A):
        if S[i] != "-":
            flag = False
            break
    else:
        if S[i] == "-":
            flag = False
            break
        a = int(S[i])
        if not (0<=a):
            flag = False
            break
        if not (a<=9):
            flag = False
            break

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
l = list(input())
for i in range(a+b+1):
    if i == a:
        if l[i] != "-":
            print("No")
            exit()
    else:
        if l[i] == "-":
            print("No")
            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:
  flag=False
  
for i in range(len(s)):
  if i==a:
    if s[i]!='-':
      flag=False
  else:
    if s[i]=='-':
      flag=False
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

arr = list(range(10))
arr = list(map(str,arr))

x = s.pop(a)

flag = True
for i in range(len(s)):
    if s[i] in arr:
        pass
    else:
        flag = False

if x == '-' and flag == True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    s=STR()
    count='1234567890'
    flg=1
    for i in range(len(s)):
        if i!=a:
            if s[i] in count:
                pass
            else:
                flg=0
        else:
            if s[i]=='-':
                pass
            else:
                flg=0
    if flg==1:
        print('Yes')
    else:
        print('No')
        
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
AB = input()  # "3 4"
S = input()  # 269-6650

A, B = AB.split()  # "3", "4"
A = int(A)  # 3
B = int(B)  # 4

# 333-4444
# 3-3-44-4
# 444444-5

def is_zip_ok(A, B, S):
  for i in range(0, A):
    if not S[i].isdecimal():
      return False

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

  for i in range(A + 1, A + B + 1):
    if not S[i].isdecimal():
      return False

  return True

if is_zip_ok(A, B, S):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
ab = input()  # "3 4"
s = input()  # "269-6650"

a, b = ab.split()  # "3", "4"
a = int(a)
b = int(b)

def is_zip_correct(a, b, s):
    if len(s) != a + b + 1:
        # print("invalid len")
        return False

    # ハイフンの前までが数字か
    for i in range(0, a):
        if not s[i].isdecimal():
            # print("invalid decimal(1) {}".format(s[i]))
            return False

    # 正しい位置にハイフンがあるか
    if s[a] != '-':
        # print("invalid hyphone".format(s[i]))
        return False

    # ハイフンの後ろが数字か
    for i in range(a + 1, a + b + 1):
        if not s[i].isdecimal():
            # print("invalid decimal".format(s[i]))
            return False

    return True

if is_zip_correct(a, b, s):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

l=S.split("-")
#print(len(l[0]),len(l[1]))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B = map(int, readline().split())
S = readline().decode('utf8').rstrip()
T=S[:A]+S[A+1:]
bl = S[A] == '-' and T.find('-')==-1
print('Yes' if bl else 'No')

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B = map(int, readline().split())
S = readline().decode('utf8').rstrip()
T=S[:A]+S[A+1:]
bl = S[A] == '-' and not('-' in T)

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B = map(int, readline().split())
S = readline().decode('utf8').rstrip()

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

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
s = input()
#print(s[a],s.count('-'))
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()

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

Submission status: Accepted

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

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

if S[A] != '-':
  ans = "No"
elif parta.isdecimal() and partb.isdecimal():
  ans = "Yes"
else:
  ans = "No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
a,b = map(int,input().split())
s = input()
flag = 0
for i in range(a+b+1):
    if i < a or i > a :
        if s[i] == "-": flag = 1
        """if ord(s[i]) < 48 or ord(s[i]) > 57:
            flag = 1"""
    elif s[i] != "-":
        flag = 1
print("Yes" if flag == 0 else "No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
a,b = map(int,input().split())
s = input()
flag = 0
for i in range(a+b+1):
    if i < a or i > a :
        if ord(s[i]) < 48 or ord(s[i]) > 57:
            flag = 1
    elif s[i] != "-":
        flag = 1
print("Yes" if flag == 0 else "No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

n,m = map(int,input().split())
s = input()
flag = 0
for i in s:
    if i == "-":
        flag += 1


if len(s)==n+m+1 and flag == 1 and s[n] == "-":
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

if re.fullmatch("\d{%s}-\d{%s}" % (a, b), s):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

if len(s)!=a+b+1:
  print("No")
  exit()

for i in range(len(s)):
  if i<a:
    if s[i] not in ["0","1","2","3","4","5","6","7","8","9"]:
      print("No")
      exit()
  elif i==a:
    if s[i] != "-":
      print("No")
      exit()
  elif i<a+b+1:    
    if s[i] not in ["0","1","2","3","4","5","6","7","8","9"]:
      print("No")
      exit()
print("Yes")
exit()

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 not '0' <= s[i] <= '9':
      print('No')
      exit()
  
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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