Language: C++


#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main()
{
  string S;
  cin >> S;
  sort(S.begin(), S.end());
  S.erase(unique(S.begin(), S.end()), S.end);
  cout << (4 == S.length() ? "Good" : "Bad");
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: no matching function for call to 'std::__cxx11::basic_string<char>::erase(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >, <unresolved overloaded function type>)'
   12 |   S.erase(unique(S.begin(), S.end()), S.end);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:3:
/usr/include/c++/14/bits/basic_string.h:2114:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 2114 |       erase(size_type __pos = 0, size_type __n = npos)
      |       ^~~~~
/usr/include/c++/14/bits/basic_string.h:2114:23: note:   no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
 2114 |       erase(size_type __pos = 0, size_type __n = npos)
      |             ~~~~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:2134:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(__const_iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
 2134 |       erase(__const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/basic_string.h:2134:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/basic_string.h:2154:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(__const_iterator, __const_iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
 2154 |       erase(__const_iterator __first, __const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/basic_string.h:2154:56: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
 2154 |       erase(__const_iterator __first, __const_iterator __last)
      |                                       ~~~~~~~~~~~~~~~~~^~~~~~