Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  string A, B, S;
  cin >> A >> B >> S;
  cout << ((regex_match(S, ("\\d{" + A + "}-\\d{" + B + "}"))) ? "Yes" : "No") << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:24: error: no matching function for call to 'regex_match(std::string&, std::__cxx11::basic_string<char>)'
    7 |   cout << ((regex_match(S, ("\\d{" + A + "}-\\d{" + B + "}"))) ? "Yes" : "No") << "\n";
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
                 from a.cc:1:
/usr/include/c++/14/bits/regex.h:2261:5: note: candidate: 'template<class _Bi_iter, class _Alloc, class _Ch_type, class _Rx_traits> bool std::regex_match(_Bi_iter, _Bi_iter, __cxx11::match_results<_BiIter, _Alloc>&, const __cxx11::basic_regex<_CharT, _TraitsT>&, regex_constants::match_flag_type)'
 2261 |     regex_match(_Bi_iter                                 __s,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2261:5: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/regex.h:2288:5: note: candidate: 'template<class _Bi_iter, class _Ch_type, class _Rx_traits> bool std::regex_match(_Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
 2288 |     regex_match(_Bi_iter __first, _Bi_iter __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2288:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/regex.h:2313:5: note: candidate: 'template<class _Ch_type, class _Alloc, class _Rx_traits> bool std::regex_match(const _Ch_type*, __cxx11::match_results<const _Ch_type*, _Alloc>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
 2313 |     regex_match(const _Ch_type* __s,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2313:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/regex.h:2337:5: note: candidate: 'template<class _Ch_traits, class _Ch_alloc, class _Alloc, class _Ch_type, class _Rx_traits> bool std::regex_match(const __cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&, __cxx11::match_results<typename __cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
 2337 |     regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2337:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/regex.h:2351:5: note: candidate: 'template<class _Ch_traits, class _Ch_alloc, class _Alloc, class _Ch_type, class _Rx_traits> bool std::regex_match(const __cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&, __cxx11::match_results<typename __cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)' (deleted)
 2351 |     regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2351:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/regex.h:2373:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> bool std::regex_match(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
 2373 |     regex_match(const _Ch_type* __s,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2373:5: note:   template argument deduction/substitution failed:
a.cc:7:24: note:   mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>'
    7 |   cout << ((regex_match(S, ("\\d{" + A + "}-\\d{" + B + "}"))) ? "Yes" : "No") << "\n";
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2395:5: note: candidate: 'template<class _Ch_traits, class _Str_allocator, class _Ch_type, class _Rx_traits> bool std::regex_match(const __cxx11::basic_string<_Ch_type, _Ch_traits, _Str_allocator>&, const __cxx11::basic_regex<_CharT, _TraitsT>&, regex_constants::match_flag_type)'
 2395 |     regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2395:5: note:   template argument deduction/substitution failed:
a.cc:7:24: note:   'std::__cxx11::basic_string<char>' is not derived from 'const std::__cxx11::basic_regex<_CharT, _TraitsT>'
    7 |   cout << ((regex_match(S, ("\\d{" + A + "}-\\d{" + B + "}"))) ? "Yes" : "No") << "\n";
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~