Language: C++

#include <bits/stdc++.h>
#include <cctype>
#include <algorithm>


bool ish(std::string c) {
    return c == "-";
}

bool is_all(std::string a, std::string b, std::string c) {
    if (std::all_of(a.cbegin(), a.cend(), isdigit)) {
        if(std::all_of(b.cbegin(),b.cend(),ish)){
            if (std::all_of(c.cbegin(),c.cend(),isdigit))
                return true;
        }
    }
}

int main() {
    using std::string;
    using std::cin;
    using std::cout;
    using std::endl;
    int a, b;
    string s;
    cin >> a >> b;
    cin >> s;
    std::string sub0 = s.substr(0, a);
    std::string sub1 = s.substr(a + 1, 1);
    std::string sub2 = s.substr(a + 2, b);
    if (is_all(sub0,sub1,sub2)){
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }
}



Compiler output:
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_negate<_Predicate>::operator()(_Iterator) [with _Iterator = __gnu_cxx::__normal_iterator<const char*, std::__cxx11::basic_string<char> >; _Predicate = bool (*)(std::__cxx11::basic_string<char>)]':
/usr/include/c++/14/bits/stl_algobase.h:2107:14:   required from '_RandomAccessIterator std::__find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate, random_access_iterator_tag) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >; _Predicate = __gnu_cxx::__ops::_Iter_negate<bool (*)(__cxx11::basic_string<char>)>]'
 2107 |           if (__pred(__first))
      |               ~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:112:28:   required from '_InputIterator std::__find_if_not(_InputIterator, _InputIterator, _Predicate) [with _InputIterator = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >; _Predicate = __gnu_cxx::__ops::_Iter_pred<bool (*)(__cxx11::basic_string<char>)>]'
  112 |       return std::__find_if(__first, __last,
      |              ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
  113 |                             __gnu_cxx::__ops::__negate(__pred),
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  114 |                             std::__iterator_category(__first));
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:471:32:   required from '_IIter std::find_if_not(_IIter, _IIter, _Predicate) [with _IIter = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >; _Predicate = bool (*)(__cxx11::basic_string<char>)]'
  471 |       return std::__find_if_not(__first, __last,
      |              ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
  472 |                                 __gnu_cxx::__ops::__pred_iter(__pred));
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:411:40:   required from 'bool std::all_of(_IIter, _IIter, _Predicate) [with _IIter = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >; _Predicate = bool (*)(__cxx11::basic_string<char>)]'
  411 |     { return __last == std::find_if_not(__first, __last, __pred); }
      |                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:12:23:   required from here
   12 |         if(std::all_of(b.cbegin(),b.cend(),ish)){
      |            ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:395:31: error: could not convert '__it.__gnu_cxx::__normal_iterator<const char*, std::__cxx11::basic_string<char> >::operator*()' from 'const char' to 'std::__cxx11::basic_string<char>'
  395 |         { return !bool(_M_pred(*__it)); }
      |                        ~~~~~~~^~~~~~~
      |                               |
      |                               const char
a.cc: In function 'bool is_all(std::string, std::string, std::string)':
a.cc:17:1: warning: control reaches end of non-void function [-Wreturn-type]
   17 | }
      | ^