Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
using namespace std;

int main(void) {

	int A, B;
	string S;
	cin >> A >> B >> S;

	if (S.size() <= A)
	{
		cout << "No" << endl;
		return 0;
	}

	if (S.substr(A, 1) != "-")
	{
		cout << "No" << endl;
		return 0;
	}

	string front = S.substr(0, A);
	if (all_of(front.cbegin(), front.cend(), isdigit) == false)
	{
		cout << "No" << endl;
		return 0;
	}

	string rear = S.substr(A + 1);
	if (all_of(rear.cbegin(), rear.cend(), isdigit) == false)
	{
		cout << "No" << endl;
		return 0;
	}

    cout << "Yes" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:19: 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>)'
   28 |         if (all_of(front.cbegin(), front.cend(), isdigit) == false)
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:28:19: note:   couldn't deduce template parameter '_Predicate'
   28 |         if (all_of(front.cbegin(), front.cend(), isdigit) == false)
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:35:19: 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>)'
   35 |         if (all_of(rear.cbegin(), rear.cend(), isdigit) == false)
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:35:19: note:   couldn't deduce template parameter '_Predicate'
   35 |         if (all_of(rear.cbegin(), rear.cend(), isdigit) == false)
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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