Language: C++

#include <bits/stdc++.h>
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  map<string,int> m;
  REP(i, 4) {
    if(m.find(S[i]) == m.end()) {
      m.insert({S[i],1});
    } else {
      m.find(S[i])->second++;
    }
  }
  if (m.size() == 2 && m[0].second == 2 && m[1].second == 2) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: no matching function for call to 'std::map<std::__cxx11::basic_string<char>, long long int>::find(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
   20 |     if(m.find(S[i]) == m.end()) {
      |        ~~~~~~^~~~~~
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:1224:9: note: candidate: 'template<class _Kt> decltype (((std::map<_Key, _Tp, _Compare, _Alloc>*)this)->std::map<_Key, _Tp, _Compare, _Alloc>::_M_t._M_find_tr(__x)) std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Kt&) [with _Key = std::__cxx11::basic_string<char>; _Tp = long long int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> >]'
 1224 |         find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x))
      |         ^~~~
/usr/include/c++/14/bits/stl_map.h:1224:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_map.h: In substitution of 'template<class _Kt> decltype (((std::map<std::__cxx11::basic_string<char>, long long int>*)this)->std::map<std::__cxx11::basic_string<char>, long long int>::_M_t.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, long long int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, long long int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> > >::_M_find_tr(__x)) std::map<std::__cxx11::basic_string<char>, long long int>::find(const _Kt&) [with _Kt = char]':
a.cc:20:14:   required from here
   20 |     if(m.find(S[i]) == m.end()) {
      |        ~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_map.h:1224:57: error: no matching function for call to 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, long long int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, long long int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> > >::_M_find_tr(const char&)'
 1224 |         find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x))
      |                                          ~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/map:62:
/usr/include/c++/14/bits/stl_tree.h:1291:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_find_tr(const _Kt&) [with _Req = _Kt; _Key = std::__cxx11::basic_string<char>; _Val = std::pair<const std::__cxx11::basic_string<char>, long long int>; _KeyOfValue = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, long long int> >; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> >]'
 1291 |         _M_find_tr(const _Kt& __k)
      |         ^~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:1291:9: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/14/string:49,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/stl_function.h: In substitution of 'template<class _Func, class _SfinaeType> using std::__has_is_transparent_t = typename std::__has_is_transparent<_Func, _SfinaeType>::type [with _Func = std::less<std::__cxx11::basic_string<char> >; _SfinaeType = char]':
/usr/include/c++/14/bits/stl_tree.h:1289:9:   required by substitution of 'template<class _Kt> decltype (((std::map<std::__cxx11::basic_string<char>, long long int>*)this)->std::map<std::__cxx11::basic_string<char>, long long int>::_M_t.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, long long int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, long long int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> > >::_M_find_tr(__x)) std::map<std::__cxx11::basic_string<char>, long long int>::find(const _Kt&) [with _Kt = char]'
 1289 |                typename _Req = __has_is_transparent_t<_Compare, _Kt>>
      |                ^~~~~~~~
a.cc:20:14:   required from here
   20 |     if(m.find(S[i]) == m.end()) {
      |        ~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_function.h:1427:11: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<std::__cxx11::basic_string<char> >, char, void>'
 1427 |     using __has_is_transparent_t
      |           ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_map.h: In substitution of 'template<class _Kt> decltype (((std::map<std::__cxx11::basic_string<char>, long long int>*)this)->std::map<std::__cxx11::basic_string<char>, long long int>::_M_t.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, long long int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, long long int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> > >::_M_find_tr(__x)) std::map<std::__cxx11::basic_string<char>, long long int>::find(const _Kt&) [with _Kt = char]':
a.cc:20:14:   required from here
   20 |     if(m.find(S[i]) == m.end()) {
      |        ~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_tree.h:1300:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_find_tr(const _Kt&) const [with _Req = _Kt; _Key = std::__cxx11::basic_string<char>; _Val = std::pair<const std::__cxx11::basic_string<char>, long long int>; _KeyOfValue = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, long long int> >; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> >]'
 1300 |         _M_find_tr(const _Kt& __k) const
      |         ^~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:1300:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_map.h:1249:9: note: candidate: 'template<class _Kt> decltype (((const std::map<_Key, _Tp, _Compare, _Alloc>*)this)->std::map<_Key, _Tp, _Compare, _Alloc>::_M_t._M_find_tr(__x)) std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Kt&) const [with _Key = std::__cxx11::basic_string<char>; _Tp = long long int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> >]'
 1249 |         find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x))
      |         ^~~~
/usr/include/c++/14/bits/stl_map.h:1249:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_map.h: In substitution of 'template<class _Kt> decltype (((const std::map<std::__cxx11::basic_string<char>, long long int>*)this)->std::map<std::__cxx11::basic_string<char>, long long int>::_M_t.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, long long int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, long long int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> > >::_M_find_tr(__x)) std::map<std::__cxx11::basic_string<char>, long long int>::find(const _Kt&) const [with _Kt = char]':
a.cc:20:14:   required from here
   20 |     if(m.find(S[i]) == m.end()) {
      |        ~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_map.h:1249:63: error: no matching function for call to 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, long long int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, long long int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> > >::_M_find_tr(const char&) const'
 1249 |         find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x))
      |                                                ~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/stl_tree.h:1291:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_find_tr(const _Kt&) [with _Req = _Kt; _Key = std::__cxx11::basic_string<char>; _Val = std::pair<const std::__cxx11::basic_string<char>, long long int>; _KeyOfValue = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, long long int> >; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> >]'
 1291 |         _M_find_tr(const _Kt& __k)
      |         ^~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:1291:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_tree.h:1300:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_find_tr(const _Kt&) const [with _Req = _Kt; _Key = std::__cxx11::basic_string<char>; _Val = std::pair<const std::__cxx11::basic_string<char>, long long int>; _KeyOfValue = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, long long int> >; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> >]'
 1300 |         _M_find_tr(const _Kt& __k) const
      |         ^~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:1300:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_map.h:1218:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>