Submission #1677283


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
int main()
{
  string str;
  cin >> str;

  if (str == 'a')
    cout << -1 << endl;
  else
  {
    string shorter;
    for (int i = 0; i < str.length(); ++i){
      shorter.push_back('a');
    }
    cout << shorter << endl;
  }
  return 0;
}

Submission Info

Submission Time
Task B - 辞書式順序
User aximov
Language C++14 (GCC 5.4.1)
Score 0
Code Size 305 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:8:11: error: no match for ‘operator==’ (operand types are ‘std::string {aka std::basic_string<char>}’ and ‘char’)
   if (str == 'a')
           ^
In file included from /usr/include/c++/5/unordered_set:48:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:116,
                 from ./Main.cpp:1:
/usr/include/c++/5/bits/unordered_set.h:1421:5: note: candidate: template<class _Value, class _Hash, class _Pred, class _Alloc> bool std::operator==(const std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>&, const std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>&)
     operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
     ^
/usr/include/c++/5/bits/unordered_set.h:1421:5: note:   template argument deduction/substitution failed:
./Main.cpp:8:14: note:   ‘std::string {aka std::basic_string<char>}’ is not derived from ‘const std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>’
   if (str == 'a')
              ^
In fi...