Language: C++

#include <iostream>
#include <string>
#include <set>

int main() {
  std::string S;
  std::set exit;
  
  std::cin >> S;
  
  for (int i = 0; i < S.size(); i++) {
    if (exit.find(S[i]) == exit.end()) {
      exit.insert(S[i]);
    }
  }
  
  if (exit.size() == 2)
    std::cout << "Yes" << std::endl;
  else 
    std::cout << "No" << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: class template argument deduction failed:
    7 |   std::set exit;
      |            ^~~~
a.cc:7:12: error: no matching function for call to 'set()'
In file included from /usr/include/c++/14/set:63,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_set.h:273:9: note: candidate: 'template<class _Key, class _Compare, class _Alloc, class _InputIterator> set(_InputIterator, _InputIterator, const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  273 |         set(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:273:9: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:267:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(std::initializer_list<_Tp>, const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  267 |       set(initializer_list<value_type> __l, const allocator_type& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:267:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:261:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(std::set<_Key, _Compare, _Allocator>&&, std::__type_identity_t<_Alloc>&)-> std::set<_Key, _Compare, _Alloc>'
  261 |       set(set&& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:261:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:257:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(const std::set<_Key, _Compare, _Allocator>&, std::__type_identity_t<_Alloc>&)-> std::set<_Key, _Compare, _Alloc>'
  257 |       set(const set& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:257:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:253:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  253 |       set(const allocator_type& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:253:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:245:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(std::initializer_list<_Tp>, const _Compare&, const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  245 |       set(initializer_list<value_type> __l,
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:245:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:233:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(std::set<_Key, _Compare, _Allocator>&&)-> std::set<_Key, _Compare, _Alloc>'
  233 |       set(set&&) = default;
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:233:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:225:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(const std::set<_Key, _Compare, _Allocator>&)-> std::set<_Key, _Compare, _Alloc>'
  225 |       set(const set&) = default;
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:225:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:210:9: note: candidate: 'template<class _Key, class _Compare, class _Alloc, class _InputIterator> set(_InputIterator, _InputIterator, const _Compare&, const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  210 |         set(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:210:9: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:193:9: note: candidate: 'template<class _Key, class _Compare, class _Alloc, class _InputIterator> set(_InputIterator, _InputIterator)-> std::set<_Key, _Compare, _Alloc>'
  193 |         set(_InputIterator __first, _InputIterator __last)
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:193:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:178:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(const _Compare&, const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  178 |       set(const _Compare& __comp,
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:178:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:169:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set()-> std::set<_Key, _Compare, _Alloc>'
  169 |       set() = default;
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:169:7: note:   template argument deduction/substitution failed:
a.cc:7:12: note:   couldn't deduce template parameter '_Key'
    7 |   std::set exit;
      |            ^~~~
/usr/include/c++/14/bits/stl_set.h:96:11: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(std::set<_Key, _Compare, _Alloc>)-> std::set<_Key, _Compare, _Alloc>'
   96 |     class set
      |           ^~~
/usr/include/c++/14/bits/stl_set.h:96:11: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:970:5: note: candidate: 'template<class _Key, class _Allocator, class> std::set(initializer_list<_Tp>, _Allocator)-> set<_Key, less<_Key>, _Allocator>'
  970 |     set(initializer_list<_Key>, _Allocator)
      |     ^~~
/usr/include/c++/14/bits/stl_set.h:970:5: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:963:5: note: candidate: 'template<class _InputIterator, class _Allocator, class, class> std::set(_InputIterator, _InputIterator, _Allocator)-> set<typename iterator_traits<_Iter>::value_type, less<typename iterator_traits< <template-parameter-1-1> >::value_type>, _Allocator>'
  963 |     set(_InputIterator, _InputIterator, _Allocator)
      |     ^~~
/usr/include/c++/14/bits/stl_set.h:963:5: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:956:5: note: candidate: 'template<class _Key, class _Compare, class _Allocator, class, class> std::set(initializer_list<_Tp>, _Compare, _Allocator)-> set<_Key, _Compare, _Allocator>'
  956 |     set(initializer_list<_Key>,
      |     ^~~
/usr/include/c++/14/bits/stl_set.h:956:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:947:5: note: candidate: 'template<class _InputIterator, class _Compare, class _Allocator, class, class, class> std::set(_InputIterator, _InputIterator, _Compare, _Allocator)-> set<typename iterator_traits<_Iter>::value_type, _Compare, _Allocator>'
  947 |     set(_InputIterator, _InputIterator,
      |     ^~~
/usr/include/c++/14/bits/stl_set.h:947:5: note:   candidate expects 2 arguments, 0 provided