Preview:
}


#include <iostream>

using namespace std;

int main()
{
    int A,B,N; 
    cin>>A>>B ; 
    N=A+B+1 ; 
    int Y; 
    string X[N] ;
    for(int i=1 ;i<=N ;i++){
       cin>>X[i] ;  
       if(X[i]=="-"){
           Y=i ;
       } 
    } 
    int Flag=1 ;
    for(int i=1 ;i<=N ;i++){ 
        if(i==Y){
            continue ;
        }
        if(X[i]<"0" ||X[i]>"9"){
            Flag=0 ; 
            break ;
        } 
        
    } 
    if(Flag==1 &&Y==A+1){
        cout<<"Yes"<<endl;
    } 
    else{
        cout<<"No"<<endl;
    }
    
    

    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter