fork download
  1. #include"bits/stdc++.h"
  2. using namespace std;
  3. int main()
  4. {
  5. int a,b,k,counter=0;
  6. string s;
  7. cin>>a>>b;
  8. cin>>s;
  9. k=a+b+1;
  10. if(!(s.size()==k))
  11. {
  12. cout<<"lala";
  13. return 0;
  14. }
  15. for(int i=0;i<s.size();i++)
  16. {
  17. if((s[i]>='0' && s[i]<='9' && s[a]=='-')==false)
  18. {
  19. cout<<"no";
  20. return 0;
  21. }
  22. }
  23. cout<<"yes";
  24. }
  25.  
Success #stdin #stdout 0s 4456KB
stdin
3 4
269-6650
stdout
no