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:
# class Node:
#     def __init__(self, data): #コンストラクタ
#         self.data = data #ノードがもつ数値
#         self.left = None #左エッジ
#         self.right = None #右エッジ
#
# class BST:
#     def __init__(self, number_list): #コンストラクタ
#         self.root = None #ルート初期化
#         for node in number_list: #数値を持つ配列から二分木を生成
#             self.insert(node) #挿入メソッドを使ってノードを挿入する
#
#     #挿入
#     def insert(self, data):
#         n = self.root #nにルートを代入
#         if n == None: #ルートに何も入っていない場合
#             self.root = Node(data) #ルートにノードを代入(二分探索木の一番上の部分が出来る)
#             return #呼び出し部分に戻る
#         else: #ルートノードに既に数値が入ってる場合
#             while True: #return等が入るまでずっと実行
#                 entry = n.data #entryにnが持つデータ(数値)を入れる
#                 if data < entry: #entryとdata(代入するデータ)を比較してentryの方が大きい場合
#                     if n.left is None: #nの左エッジに何も入っていない場合
#                         n.left = Node(data) #nの左エッジにdata(代入するデータ)を代入
#                         return ##呼び出し部分に戻る
#                     n = n.left #nの左に何か入っている場合nにnのleftを代入
#                 elif data > entry: #entryとdata(代入するデータ)を比較してentryの方が小さい場合
#                     if n.right is None: #nの右エッジに何も入っていない場合
#                         n.right = Node(data) #nの右エッジにdata(代入するデータ)を代入
#                         return #呼び出し部分に戻る
#                     n = n.right #nの右エッジに何か入っている場合nにnのrightを代入
#                 else: #上2つの条件分岐以外の場合
#                     n.data = data #nのdataにdata(代入するデータ)を代入
#                     return #呼び出し部分に戻る

a, b = map(int, input().split())
s = list(input())
no = 0
if s[a] != "-":
    print("No")
    no = 1
else:
    for i in s[:a] + s[a + 1::]:
        if not ("0" <= i <= "9"):
            print("No")
            no = 1
            break
if not no:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
A, B = map(int, input().split())
S = input()
ls = [str(i) for i in range(10)]
for i, x in enumerate(S):
    if i == A:
        if x != '-':
            print('No')
            sys.exit()
    else:
        if not x in ls:
            print('No')
            sys.exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

flag = True

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

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

Submission status: Accepted

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

flg ="Yes"

if n[a] != "-":
    flg ="No"

ls = [str(x) for x in range(10)]
s = set(ls)

if  (set(n[0:a]) | set(n[a+1:a+b+2])) <=s:
    pass
else:
    flg = "No"

print(flg)

Submission status: Accepted

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

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

Submission status: Accepted

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

if S[a] == "-":
  if S[0:a].isdecimal() and S[a+1:].isdecimal():
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

s = input()

a1 = s[:a]
s1 = s[a]
b1 = s[a+1:]

if a1.isdecimal() and s1 == '-' and b1.isdecimal():
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
S = input()
ans = 0
ls = ["1","2","3","4","5","6","7","8","9","0"]
if S[A] == "-":
    for i in range(A+B+1):
        if S[i] in ls:
            ans += 1
if ans == (A+B):
    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] != "-":
    print("No")
    break
  elif i != A and S[i] == "-":
    print("No")
    break
else:
  print("Yes")

Submission status: Accepted

Solution code:
import math


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

number = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
flag = True
for i in range(A+B+1):
    if i == A:
        if S[i] != '-':
            flag = False
    else:
        if S[i] in number:
            pass
        else:
            flag = False

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
a = ''
b = ''
cnt = 0
for i in range(0, len(S)):
	if S[i] == '-':
		cnt += 1
	elif cnt == 0:
		a = a + S[i]
	else: b = b + S[i]
if cnt == 1 and len(a) == A and len(b) == B:
	print('Yes')
else: print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

if len(s) == a+b+1 and s[a] == "-":
    x = s[:a]
    y = s[a+1:]
    for i in x:
        if i not in ans:
            print("No")
            break
    else:
        for j in y:
            if j not in ans:
                print("No")
                break
        else:
            print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

def solve(A: int, B: int, S: str):
    ret = YES
    for i, c in enumerate(S):
        if i == A and c != '-':
            ret = NO
        if i != A and not '0' <= c <= '9':
            ret = NO
    print(ret)
    return


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

if len(s)!=a+b+1:
  print('No')
  exit()
if '-' in s[0:a]:
  print('No')
  exit()
if s[a]!='-':
  print('No')
  exit()
if '-' in s[a+1:]:
  print('No')
  exit()
print('Yes')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
#print(ab)
x=input()
#print(x)
x1=x[:a]
x2=x[a]
x3=x[a+1:a+b+1]
#print(x1)
#print(x2)
#print(x3)


if x2=="-" and  (all(x1[i] in ["0","1","2","3","4","5","6","7","8","9"] for i in range(a))) and (all(x3[j] in ["0","1","2","3","4","5","6","7","8","9"]   for j in range(b))):
    print("Yes")
else:
    print("No")

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 = [ int(v) for v in input().split() ]
s = input()
if s[a] == "-" and s[:a].count("-") == 0 and  s[a+1:].count("-") == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

for i in s:
    if i == '-':
        continue
    elif int(i)>= 0 and int(i)<= 9:
        num += 1
    
    

if a + b == num and s[a] == '-':
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
s = list(input())
x = ["0","1","2","3","4","5","6","7","8","9"]
flag = True
for i in range(a):
    if not s[i] in x:
        flag = False
for i in range(b):
    if not s[a+1+i] in x:
        flag = False
if s[a] != "-":
    flag = False
if flag:
    print("Yes")
else:
    print("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 == a:
        if s[i] != '-':
            ans = "No"
            break
    else:
        if s[i] not in "0123456789":
            ans = "No"
            break

print(ans)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
s = input()
f = True
for i in range(len(s)):
    if i == a:
        continue
    if s[i] > "9" or s[i] < "0":
        f=False

if s[a] != "-":
    f= False

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

Submission status: Accepted

Solution code:
from sys import stdin
A,B=[int(x) for x in stdin.readline().rstrip().split()]
S=(stdin.readline().rstrip())
flag=True
if S[:A].isdecimal() != True:
    flag = False
elif S[A:A+1] != "-":
    flag = False
elif S[A+1:].isdecimal() != True:
    flag = False

if flag:
    print("Yes")
else:
    print("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] < '0' or S[i] > '9':
            flag = False
            break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    A, B = (int(_) for _ in input().split())
    S = input()
    if S.count('-') != 1:
        print('No')
        return
    before_str, after_str = S.split('-')
    if len(before_str) == A and len(after_str)  ==B:
        print('Yes')
    else:
        print('No')
        
if __name__ == '__main__':
    main()

Submission status: Accepted

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

if len(S) != A+B+1:
    print("No")
else:
    for i in range(A):
        if S[i] == "-":
            print("No")
            break
        else:
            c += 1

if c == A:
    if S[A] != "-":
        print("No")
        c += 1
    else:
        for j in range(A+1,A+B+1):
            if S[j] == "-":
                print("No")
                c += 1
                break

if c == A:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
A,b = map(int,input().split())
S = input()
ok = True
for i in range(len(S)):
    if i == A:
        if S[i] == "-":
            pass
        else:
            ok = False 
    else:
        if re.match("\d",S[i]):
            pass
        else:
            ok = False
if ok:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
A,_ = input().split()
S = input()
flag = (S.count('-') == 1) and (S.find('-') == int(A))
print('Yes' if flag else 'No')

Submission status: Accepted

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

# A+1番目が'-'出ない場合は'No'
if S[A]!='-':
  print('No')
  exit()
else:
  for x in S[:A]:
    # 1文字目からA文字目までが数字であることを確認
    if x not in '0123456789':
      print('No')
      exit()
  
  for x in S[A+2:]:
    # A+2文字目から最後までが数字であることを確認
    if x not in '0123456789':
      print('No')
      exit()

# チェックに引っかからなければ形式を満たす文字列である
print('Yes')

Submission status: Accepted

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

# A+1番目が'-'出ない場合は'No'
if S[A]!='-':
  print('No')
  exit()
else:
  for x in S[:A]:
    if x not in '0123456789':
      print('No')
      exit()
  for x in S[A+2:]:
    if x not in '0123456789':
      print('No')
      exit()

# チェックに引っかからなければ形式を満たす文字列
print('Yes')

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
S = input().split("-")
if len(S) != 2:
    print("No")
elif 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()
pos = S.split('-')
if len(pos[0]) == A and len(pos[1]) == B and len(pos) == 2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

p=s[:a]
q=s[a+1:]

if s[a]=="-" and p.isdecimal() and q.isdecimal():
    print("Yes")
else:
    print("No")

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()
number = ('0','1','2','3','4','5','6','7','8','9')
if s[a] != '-':
        print('No')
        exit()
for i in range(a + b + 1):
        if i == a:
                i += 1
        if s[i] not in number:
                print('No')
                exit()
print('Yes')

Submission status: Accepted

Solution code:

A,B =map(int,input().split())
hih=0
num=1
test=1
S=str(input())
S= list(S)
for s in S:
    if num==A+1 and s=="-":
        hih=1
    if num!=A+1 and s=="-":
        test=0
        
    
    num+=1
if hih==1 and test==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

if s[a] == "-" and s.count("-") == 1 and len(s) == a+b+1:
    print("Yes")
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[a] == "-" 
            and s.count("-") == 1
            
			else "No")

Submission status: Accepted

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

Submission status: Accepted

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

flag = True

if (S[A]!="-"):
    flag = False
if (not S[:A].isdigit()):
    flag = False
if (not S[A+1:A+B+1].isdigit()):
    flag = False

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
k = input().split()

s = input()

a = int(k[0])
b =int(k[1])

j = 1
for t in range(a+b+1):
    if t!=a:
        try:
            if int(s[t]) >= 0 and int(s[t]) <= 9:
                pass
            else:
                j = 0
                
        except:
            j = 0
    else:
        if s[t] != "-":
            j =0
if j:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    m = II()
    print(48-m)
    return

#B
def B():
    a, b = LI()
    s = S()
    ans = list(map(str, range(10)))
    for num, si in enumerate(s):
        if num != a:
            if si in ans:
                continue
            print("No")
            return
        else:
            if si == "-":
                continue
            print("No")
            return
    print("Yes")
    return

#C
def C():
    return

#D
def D():
    a = II()
    ans = inf
    b = 0
    for k in range(1, 10 ** 5):
        b += a
        ans = min(ans, sum(list(map(int, list(str(b))))))
    print(ans)
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
import math

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

flg = 0
for i in range(len(s)):
    if i == a:
        if s[i] != '-':
            flg = 1
    else:
        if s[i] == '-':
            flg = 1
if flg == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
S=input()
flag=True
for i in range(A):
    if S[i] not in '0123456789':
        flag=False
        break
if S[A]!='-':
    flag=False
for i in range(B):
    if S[i+A+1] not in '0123456789':
        flag=False
        break
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("-")==1:
 print("Yes")
else:
 print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

    for i in range(len(S)):
        if i == A:
            if S[A] == "-":
                continue
            print("No")
            return 
        try:
            int(S[i])
        except:
            print("No")
            return
    print("Yes")

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def ipt(N=0,switch=0):
    if N == 0:
        return list(map(int,input().split()))
    else:
        if switch==0:
            return [list(map(int,input().split())) for _ in range(N)]
        else:
            return [int(input()) for _ in range(N)]

a,b=ipt()
s=input()

flag=0
for i in range(a):
    if s[i] == "-":
        flag=1
        break

if s[a] != "-":
    flag=1
        
for i in range(a+1,a+b+1):
    if s[i] == "-":
        flag=1
        break
if flag==0:
    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 and S[:A].isdecimal() and S[A+1].isdecimal():
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
a,b=input().split()
r=re.match(r'\d{'+ a +r'}-\d{'+b+r'}$',input())
print('Yes' if r else 'No')

Submission status: Accepted

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

num=set('1234567890')
if set(s[:a])<num and s[a]=='-' and set(s[a+1:])<num:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a, b = (int(i) for i in input().split())  
x = input()
if all([x[:a].isdecimal(),x[-b:].isdecimal(),x[a:a+1]=="-"]):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in S[:A]:
  if i == '-':
    flag = False
if S[A] !='-':
  flag = False
for i in S[A+1:A+B+1]:
  if 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()))
flg = 1
digit = ['1','2','3','4','5','6','7','8','9','0']
if len(S) != A+B+1:
  flg = 0
elif S[A] != '-':
  flg = 0
else:
  for i in range(0, A):
    if S[i] not in digit:
      flg = 0
      break
  for i in range(A+1,A+B+1):
    if S[i] not in digit:
      flg = 0
      break
if flg:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b = f()
    s = input()

    for i in range(a+b+1):
        if i == a:
            if s[i] != '-':
                print('No')
                return
        else:
            if s[i] not in [str(k) for k in range(10)]:
                print('No')
                return

    
    print('Yes')


solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def read_input():
    a, b = map(int, input().split())
    s = input()
    return a, b, s

def check_digit(s, n):
    if len(s) != n:
        return False

    for c in s:
        if c not in '1234567890':
            return False
    return True


def submit():
    a, b, s = read_input()

    former = s[:a]
    hi = s[a]
    latter = s[a+1:]

    if check_digit(former, a) and hi == '-' and check_digit(latter, b):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    submit()

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(a+b+1):
    if i != a and s[i] == "-":
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = input()
print("YNeos"[not all([(s[i] != '-' if i != a else s[i] == '-') for i in range(a + b + 1)])::2])

Submission status: Accepted

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

ok = False
if s.count("-") == 1:
  ind = s.index("-")
  if len(s[:ind]) == a and len(s[ind+1:]) == b:
    ok = True

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
s = input().split("-")
ans = "Yes"
if len(s) != 2:
    ans = "No"
elif len(s[0]) != A or len(s[1]) != B:
    ans = "No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import Counter

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

for i in range(len(s)):
    if i <= a-1:
        if not s[i].isdigit():
            print('No')
            sys.exit()
    elif i == a:
        if not s[i] == '-':
            print('No')
            sys.exit()
    elif i <= a + b + 1:
        if not s[i].isdigit():
            print('No')
            sys.exit()
    else:
        print('No')
        sys.exit()

print('Yes')

Submission status: Accepted

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

if S[A]!="-":
    print("No")
    sys.exit()
try:
    a = int(S[:A])
    a = int(S[A+1:])
    print("Yes")

except:
    print("No")

Submission status: Accepted

Solution code:
# ABC084B - Postal Code
a, b = list(map(int, input().rstrip().split()))
s = input()
if s[a] != "-":
    print("No")
else:
    for i in range(a + b + 1):
        if i == a:
            continue
        if s[i] not in "0123456789":
            print("No")
            break
    else:
        print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

if S.count('-') != 1:
    ans = 'No'
else:
    pos = S.find('-')
    if pos == A:
        ans = 'Yes'
    else:
        ans = 'No'
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
	
def main():
	A, B = map(int, input().split(" "))
	S = input()
	tmp = S.split("-")
	
	if len(tmp) != 2:
		print("No")
		sys.exit()
	
	if tmp[0].isdecimal() == False or tmp[1].isdecimal() == False:
		print("No")
		sys.exit()
	
	if len(tmp[0]) == A and len(tmp[1]) == B:
		print("Yes")
	else:
		print("No")
	
	
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
S = input()
ans = "No"
if S[: A].isdigit():
	if S[-B:].isdigit():
		if S[A] == "-":
			ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
def postalcode(a,b,s):
    if s[a]!="-":
        return "No"
    numbers=[str(i) for i in range(10)]
    for i in s[:a]+s[-b:]:
        if i not in numbers:
            return "No"
    return "Yes"

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

Submission status: Accepted

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