Task: | Monistus |
Sender: | Miika |
Submission time: | 2023-10-30 09:01:16 +0200 |
Language: | C++ (C++17) |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp:1:1: error: 'cpp' does not name a type 1 | cpp | ^~~ In file included from /usr/include/c++/11/iosfwd:40, from /usr/include/c++/11/ios:38, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from input/code.cpp:2: /usr/include/c++/11/bits/postypes.h:98:11: error: 'ptrdiff_t' does not name a type 98 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/11/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'? 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/11/bits/exception_ptr.h:40, from /usr/include/c++/11/exception:153, from /usr/include/c++/11/ios:39, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream...
Code
cpp#include <iostream>#include <string>#include <vector>int main() {std::string i;std::string tempstr = ".";while (tempstr != "") {int z = 0;tempstr = "";for (int f = 0; f < i.length(); ++f) {if (z > 0) {tempstr += i[f];z -= 1;if (z == 0) {i = i.substr(0, f) + tempstr + i.substr(f);break;}} else if (isdigit(i[f])) {z = int(i[f]);i = i.substr(0, f) + i.substr(f + 1);}}}std::cout << i;return 0;}