Problem lengthsort
User Yifei1234
Submission Time 2024-01-17 16:44:29
Score 0
Max Time N/A
Max Memory N/A

Compile Error

lengthsort.cpp: In function ‘int main()’:
lengthsort.cpp:22:26: error: cannot convert ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘char’
22 | letter.push_back(letter);
| ^~~~~~
| |
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/9/string:55,
from /usr/include/c++/9/bits/locale_classes.h:40,
from /usr/include/c++/9/bits/ios_base.h:41,
from /usr/include/c++/9/ios:42,
from /usr/include/c++/9/ostream:38,
from /usr/include/c++/9/iostream:39,
from lengthsort.cpp:1:
/usr/include/c++/9/bits/basic_string.h:1353:24: note: initializing argument 1 of ‘void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char