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:
num=list("0123456789")
a,b=map(int,input().split())
s=input()
 
for i in range(a+b+1):
    if i!=a:
        if s[i] not in num:
            print("No")
            break
    else:
        if s[i]!="-":
            print("No")
            break
else:
    print("Yes")

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

if S[0: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()

cnt=0
for i in range(len(S)):
  if(S[i] == "-"):
    cnt+=1
if cnt > 1:
  print("No")
  exit()

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

Submission status: Accepted

Solution code:
import re
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a,b = iim()
s = input()
#print(a,b,s[:a],s[a],s[a+1:])
ma = re.match(r'\d{%s}' %a, s[:a])
mb = re.match(r'\d{%s}' %b, s[a+1:])
#print(ma,mb)
if s[a] == '-' and ma and mb:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

s = input()

if s.count("-") == 1:
  a, b = s.split("-")
  if len(a)==A and len(b)==B:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import re
import sys


YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(A: int, B: int, S: str):
    print(YES if re.match(r"\d" * A + "-" + r"\d" * B, S) else NO)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(A, B, S)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

if S[A] == "-":
    flag = True
    for i in range(len(S)):
        if i == A:
            continue
        if not S[i].isdecimal():
            flag = False
            break
    if flag:
        ans = "Yes"

print(ans)

Submission status: Accepted

Solution code:
url = "https://atcoder.jp/contests/abc084/tasks/abc084_b"

import re


def main():
    n, m = list(map(int, input().split()))
    s = list(input())
    if s[n] != '-':
        print('No')
        exit()
    else:
        s.pop(n)

    s = ''.join(s)
    pat = '^[0-9]+$'
    rep = re.compile(pat)
    result = rep.match(s)
    if result is not None:
        if result.group() == s:
            print('Yes')
            exit()
    print('No')



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
url = "https://atcoder.jp/contests/abc084/tasks/abc084_b"

import re


def main():
    n, m = list(map(int, input().split()))
    s = list(input())

    if s[n] != '-':
        print('No')
        exit()
    else:
        s.pop(n)
    s = ''.join(s)
    pat = '^[0-9]+$'
    rep = re.compile(pat)
    result = rep.match(s)
    if result is not None:
        if result.group() == s:
            print('Yes')
            exit()
    print('No')



if __name__ == '__main__':
    main()

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(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()
f1 = S[:A].isdecimal()
f2 = S[A] == "-"
f3 = S[A+1:].isdecimal()
if f1 and f2 and f3:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

if s.count('-') == 1:
    S = s.split('-')
    if len('-'.join(S)) == a+b+1 and 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()
print('Yes' if len(S) == A + B + 1 and \
               S.count('-') == 1 and \
               S[A] == '-' else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------



# -------------------------------------------------------------
# main
# -------------------------------------------------------------

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

sa,sb = S[:A],S[A+1:]
cond = sa.count("-") == 0 and sb.count("-") == 0 and S[A] == "-"
print("Yes" if cond else "No")

Submission status: Accepted

Solution code:
def f(s):
    return all(i in '0123456789' for i in s)
a, b = map(int, input().split())
s = input()
print('Yes' if f(s[:a]) and f(s[-b:]) and s[a]=='-' else 'No')

Submission status: Accepted

Solution code:
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
# Written by NoKnowledgeGG @YlePhan
 
#import math
#mod = 10**9+7
 
 
 
def main():
  a,b = map(int,input().split())
  s = input()
  
  if s.count('-') == 1 and s[a] == '-':
    print('Yes')
  else:
    print('No')
  
if __name__ == '__main__':
  main()

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().split('-')

if len(s) != 2 or len(s[0]) != a or len(s[1]) != b:
  print('No')
else: print('Yes')

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())
S = str(input())

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
def dig(s):
    if "0"<=s<="9":
        return True
    else: return False

def dig2(s,a,b):
    for i in s[:a]:
        if not dig(i):
            return False
    if s[a]!='-':
        return False

    for i in s[a+1:]:
        if not dig(i):
            return False
    return True

print(["No","Yes"][dig2(s,a,b)])

Submission status: Accepted

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

for i in range(len(S)):
    if S[i] == '-':
        if i != a:
            print('No')
            exit()
    else:
        if i == a:
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
import fractions
import copy
import bisect
import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter


N=3
M=3
i=0
j=0
k=0
n=3
r=1
a=[0]*5
b=["0","1", "2", "3", "4", "5", "6", "7", "8", "9"]
c=[]
A,B=map(int, input().split())
#real=math.sqrt(N)
#r=int(input())
#print(real)
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"
s=input()
a=[i for i in s]
if a[A]!="-":
    print("No")
    sys.exit()


for i in range(A):
    #print(i)
    if not a[i] in b:
         print("No")
         sys.exit()

for i in range(B):
    #print(i+A)
    if not a[i+A+1] in b:
         print("No")
         sys.exit()

print("Yes")

"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ

'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき 

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation


#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b 

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''





########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re


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

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

Submission status: Accepted

Solution code:
import re

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

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


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

Submission status: Accepted

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

if not s[:a].isdecimal():
        print("No")
        exit()
if s[a] != "-":
        print("No")
        exit()
if not s[a+1:].isdecimal():
        print("No")
        exit()
print("Yes")

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:
import re
a, b = map(int, input().split())
print('Yes' if re.match(r'\d{{{}}}-\d{{{}}}'.format(a, b), input()) else 'No')

Submission status: Accepted

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

for i in range(len(s)):
    if i + 1 <= a or i - 1 >= a:
        if not s[i].isdigit():
            ans = "No"
            break
    else:
        if s[i] != "-":
            ans = "No"
            break

print(ans)

Submission status: Accepted

Solution code:
import math

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

t=s.partition("-")


if s[a]=='-' and t[0].isnumeric() and t[2].isnumeric():
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import exit
num = ["0","1","2","3","4","5","6","7","8","9"]
A, B = map(int,input().split())
S = input()
for i in range(A + B + 1):
  if i == A:
    if S[i] != "-": 
      print("No")
      exit()
  else: 
    if S[i] not in num:
      print("No")
      exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

try:
    int(S[:A])
except ValueError:
    print('No')
    exit()

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

try:
    int(S[A+1:])
except ValueError:
    print('No')
    exit()

print('Yes')

Submission status: Accepted

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

for i in range(len(s)):
  if i==a:
    if s[a]=="-":
      count+=1
  else:
    if 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":
      count+=1
      
print("Yes"if count==len(s) else"No")

Submission status: Accepted

Solution code:
import sys

A, B = map(int, input().split())
S = input()
l = ["0","1","2","3","4","5","6","7","8","9"]
if S[A] != "-":
    print("No")
    sys.exit()
for i in range(len(S)):
    if i == A:
        continue
    elif S[i] not in l:
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
S = input()

S = S.split('-')
ans = 'No'
if len(S)==2 and len(S[0])==N and len(S[1])==M:
  ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
flag1=True
if s[a]!='-':
    flag1=False
flag2=True
for i in range(0,len(s)):
    if i==a:
        continue
    if not (s[i]>='0' and s[i]<='9'):
        flag2=False
print('Yes') if flag1 and flag2 else print('No')

Submission status: Accepted

Solution code:
import re
a,b = map(int,input().split())
s = input()
if s[a]=='-' and re.match(r'^\d+$',s[:a]) and re.match(r'^\d+$',s[a+1:]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import re
a,b = map(int,input().split())
s = input()
if s[a]=='-' and re.match('^\d+$',s[:a]) and re.match('^\d+$',s[a+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:
import sys
input=sys.stdin.readline

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

ans=True
for i in range(A+B+1):
	if i==A :
		if S[i]!='-':
			ans=False
	elif S[i]=='-':
		ans=False

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

Submission status: Accepted

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

ok = True

for i in range(a + b + 1):
    if i != a:
        if not s[i].isdigit():
            ok = False
    else:
        if s[i] != '-':
            ok = False
if ok:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
def no():
    print("No")
    sys.exit()

a,b=map(int,input().split())
s=input()
num=[str(i) for i in range(10)]

if len(s)==a+b+1:
    for i in range(a):
        if s[i] not in num: no()
    if s[a]!="-": no()
    for i in range(a+1,a+b+1):
        if s[i] not in num: no()   

else: no()

print("Yes")

Submission status: Accepted

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

ans="Yes"
for i in range(0,A):
  if S[i]=="-":
    ans="No"
if S[A]!="-":
  ans="No"
for j in range(A+1,A+B+1):
  if S[j]=="-":
    ans="No"
    
print(ans)

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()
n = len(s)
ans = "Yes"
for i in range(n):
    if s[i] == '-'and i != a:
        ans = 'No'
        break
    if i == a and s[i] != '-':
        ans = 'No'
        break
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = str(input())
slist = list(s)
if not slist.count('-') == 1:
  print('No')
else:
  if slist[a] == '-':
    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[:a].isdecimal() and s[a+1:].isdecimal() else 'No')

Submission status: Accepted

Solution code:
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

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

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

Submission status: Accepted

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

slist = list(s)
if not slist.count('-') == 1:
  print('No')
else:
  if slist[a] == '-':
    print('Yes')
  else:
    print('No')

Submission status: Accepted

Solution code:
import sys

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

if len(ss) != (a+b+1):
  print("No")
  sys.exit()

#a 3  123-345
nums=["0","1","2","3","4","5","6","7","8","9"]

for i in range(len(ss)):
  if i==a:
    if ss[i]!="-":
      print("No")
      sys.exit()
  elif ss[i] not in nums:
    print("No")
    sys.exit()
print("Yes")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
l = "0123456789"
cnta = 0
cntb = 0
if S[A] != "-":
    print("No")

else:
    for i in S[:A]:
        if l.count(i) == 1:
            cnta += 1
    
    for j in S[A + 1:]:
        if l.count(j) == 1:
            cntb += 1
    if cnta == A and cntb == B:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=input()
if s[a] != '-':
    print('No')
    quit()
left=s[:a]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
s = list(input())
flg = True
for i in range(a+b+1):
    if(i!=a and s[i]=='-'):
        flg = False
        break
    elif(i==a and s[i]!='-'):
        flg = False
        break

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

Submission status: Accepted

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

ans = "Yes"
if len(S) != A+B+1:
  ans = "No"
for i, s in enumerate(S):
  if i == A:
    if s != '-':
      ans = "No"
  else:
    if not '0' <= s <= '9':
      ans = "No"
print(ans)

Submission status: Accepted

Solution code:
A,B = [int(i) for i in input().split()]
S = input()
aa = S[:A]
bb = S[A+1:]
if str.isdigit(aa) and str.isdigit(bb) and S[A] == '-':
    print("Yes")
    exit()
print("No")

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=input()
number=0
list=['0','1','2','3','4','5','6','7','8','9']
for a in range(A):
    if S[a] in list:
        number+=1
if S[A]=='-':
    number+=1
for a in range(B):
    if S[A+a+1] in list:
        number+=1
if number==A+B+1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import re
a, b = map(int, input().split())
print("Yes" if re.search("\d{{{}}}-\d{{{}}}".format(a, b), input()) else "No")

Submission status: Accepted

Solution code:
import re
a, b = map(int, input().split())
print("Yes" if re.search(r"\d{{{}}}-\d{{{}}}".format(a, b), input()) else "No")

Submission status: Accepted

Solution code:
#abc084 b
a,b=map(int,input().split())
s=input()
if s[a]=="-":
    if s[:a].isdecimal() and s[a+1].isdecimal():
        print("Yes")
    else:
        print("No")
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 and len(s)==a+b+1 else '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[a+2:] and len(s)==a+b+1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Thu Mar 12 20:05:49 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

import string

A, B = na()
S = ns()

flag = True
for i in range(len(S)):
    if i == A:
        if S[i] != '-':
            flag = False
    else:
        if S[i] not in string.digits:
            flag = False

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if s.count("-") == 1:
    print("YNeos"[s.index("-")!=a or len(s)!=a+1+b::2])
else:
    print("No")

Submission status: Accepted

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():

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

    for i in range(len(s)):
        if i==a:
            if s[i]!='-':
                print('No')
                break
        elif i!=len(s)-1:
            try:
                int(s[i])
            except:
                print('No')
                break
        else:
            print('Yes')



resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

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

pattern = r"\d{" + a + r"}-\d{" + b + r"}"

result = re.match(pattern, s)

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

Submission status: Accepted

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

for i in range(a+b+1):
    if i < a and '-' != s[i]:
        continue
    elif  a < i and i < a+b+1 and '-' != s[i]:
        continue
    elif i == a and '-' == s[i]:
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = list(input())
num = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
cnt = 0
if s[a] != "-":
  print("No")
  exit()
else:
  s.pop(a)
for i in s:
  for j in num:
    if i == j:
      cnt += 1
if cnt != len(s):
  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.count("-")==1 else "No")

Submission status: Accepted

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

if s[a]!='-':
            print('No')
            exit()
r = s[:a]
v= s[a+1:]
for i in range(len(r)):
            if str(r[i]).isdigit()==False:
                        print('No')
                        exit()
for i in range(len(v)):
            if str(v[i]).isdigit()==False:
                        print('No')
                        exit()
print('Yes')