Language: C++

#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
int main(){
  int a,b;
  string s;
  cin >> a >> b;
  cin >> s;
  if(s.compare(a+1,1,"-")==0 ){
    if(s.compare(0,a,isdigit)){
      if(s.compare(a+1,b,isdigit)){
        cout << "Yes";
      }
    }
  }else{
    cout << "No";
  }
  return 0;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: no matching function for call to 'std::__cxx11::basic_string<char>::compare(int, int&, <unresolved overloaded function type>)'
   11 |     if(s.compare(0,a,isdigit)){
      |        ~~~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:3249:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, int> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(const _Tp&) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 3249 |         compare(const _Tp& __svt) const
      |         ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3249:9: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/basic_string.h:3274:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, int> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(size_type, size_type, const _Tp&) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 3274 |         compare(size_type __pos, size_type __n, const _Tp& __svt) const
      |         ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3274:9: note:   template argument deduction/substitution failed:
a.cc:11:17: note:   couldn't deduce template parameter '_Tp'
   11 |     if(s.compare(0,a,isdigit)){
      |        ~~~~~~~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3294:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, int> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(size_type, size_type, const _Tp&, size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 3294 |         compare(size_type __pos1, size_type __n1, const _Tp& __svt,
      |         ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3294:9: note:   candidate expects 4 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:3228:7: note: candidate: 'int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 3228 |       compare(const basic_string& __str) const
      |       ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3228:7: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/basic_string.h:3325:7: note: candidate: 'int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(size_type, size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 3325 |       compare(size_type __pos, size_type __n, const basic_string& __str) const
      |       ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3325:67: note:   no known conversion for argument 3 from '<unresolved overloaded function type>' to 'const std::__cxx11::basic_string<char>&'
 3325 |       compare(size_type __pos, size_type __n, const basic_string& __str) const
      |                                               ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:3362:7: note: candidate: 'int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(size_type, size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 3362 |       compare(size_type __pos1, size_type __n1, const basic_string& __str,
      |       ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3362:7: note:   candidate expects 5 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:3393:7: note: candidate: 'int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(const _CharT*) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 3393 |       compare(const _CharT* __s) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3393:7: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/basic_string.h:3428:7: note: candidate: 'int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(size_type, size_type, const _CharT*) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 3428 |       compare(size_type __pos, size_type __n1, const _CharT* __s) const
      |       ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3428:62: note:   no known conversion for argument 3 from '<unresolved overloaded function type>' to 'const char*'
 3428 |       compare(size_type __pos, size_type __n1, const _CharT* __s) const
      |                                                ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:3467:7: note: candidate: 'int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(size_type, size_type, const _CharT*, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 3467 |       compare(size_type __pos, size_type __n1, const _CharT* __s,
      |       ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3467:7: note:   candidate expects 4 arguments, 3 provided
a.cc:12:19: error: no matching function for call to 'std::__cxx11::basic_string<char>::compare(int, int&, <unresolved overloaded function type>)'
   12 |       if(s.compare(a+1,b,isdigit)){
      |          ~~~~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3249:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, int> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(const _Tp&) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 3249 |         compare(const _Tp& __svt) const
      |         ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3249:9: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/basic_string.h:3274:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, int> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(size_type, size_type, const _Tp&) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 3274 |         compare(size_type __pos, size_type __n, const _Tp& __svt) const
      |         ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3274:9: note:   template argument deduction/substitution failed:
a.cc:12:19: note:   couldn't deduce template parameter '_Tp'
   12 |       if(s.compare(a+1,b,isdigit)){
      |          ~~~~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3294:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, int> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(size_type, size_type, const _Tp&, size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 3294 |         compare(size_type __pos1, size_type __n1, const _Tp& __svt,
      |         ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3294:9: note:   candidate expects 4 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:3228:7: note: candidate: 'int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 3228 |       compare(const basic_string& __str) const
      |       ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3228:7: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/basic_string.h:3325:7: note: candidate: 'int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(size_type, size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 3325 |       compare(size_type __pos, size_type __n, const basic_string& __str) const
      |       ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3325:67: note:   no known conversion for argument 3 from '<unresolved overloaded function type>' to 'const std::__cxx11::basic_string<char>&'
 3325 |       compare(size_type __pos, size_type __n, const basic_string& __str) const
      |                                               ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:3362:7: note: candidate: 'int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(size_type, size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 3362 |       compare(size_type __pos1, size_type __n1, const basic_string& __str,
      |       ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3362:7: note:   candidate expects 5 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:3393:7: note: candidate: 'int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(const _CharT*) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 3393 |       compare(const _CharT* __s) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3393:7: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/basic_string.h:3428:7: note: candidate: 'int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(size_type, size_type, const _CharT*) const [with _CharT = char; _Traits =