Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <ctype.h>

using namespace std;

int A, B;

string S, c, d;

int main() {

	cin >> A >> B >> S;

	string ans = "No";
	int last = 0;
	int pos = S.find("-");
	if (pos > 1) {
		c = S.substr(last, pos - last);
		if (A == c.length() && all_of(c.cbegin(), c.cend(), isdigit))
		{
			last = pos + 1;
			d = S.substr(last, S.length());
		}
		if (B == d.length() && all_of(d.cbegin(), d.cend(), isdigit))
		{
			
			ans = "Yes";
		}
	}
	cout << ans << endl;


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:46: error: no matching function for call to 'all_of(std::__cxx11::basic_string<char>::const_iterator, std::__cxx11::basic_string<char>::const_iterator, <unresolved overloaded function type>)'
   21 |                 if (A == c.length() && all_of(c.cbegin(), c.cend(), isdigit))
      |                                        ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:410:5: note: candidate: 'template<class _IIter, class _Predicate> bool std::all_of(_IIter, _IIter, _Predicate)'
  410 |     all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:410:5: note:   template argument deduction/substitution failed:
a.cc:21:46: note:   couldn't deduce template parameter '_Predicate'
   21 |                 if (A == c.length() && all_of(c.cbegin(), c.cend(), isdigit))
      |                                        ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Predicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::all_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate)'
   30 | all_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note:   candidate expects 4 arguments, 3 provided
a.cc:26:46: error: no matching function for call to 'all_of(std::__cxx11::basic_string<char>::const_iterator, std::__cxx11::basic_string<char>::const_iterator, <unresolved overloaded function type>)'
   26 |                 if (B == d.length() && all_of(d.cbegin(), d.cend(), isdigit))
      |                                        ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:410:5: note: candidate: 'template<class _IIter, class _Predicate> bool std::all_of(_IIter, _IIter, _Predicate)'
  410 |     all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:410:5: note:   template argument deduction/substitution failed:
a.cc:26:46: note:   couldn't deduce template parameter '_Predicate'
   26 |                 if (B == d.length() && all_of(d.cbegin(), d.cend(), isdigit))
      |                                        ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Predicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::all_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate)'
   30 | all_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note:   candidate expects 4 arguments, 3 provided