| Task: | Monistus |
| Sender: | maweiyin24562 |
| Submission time: | 2023-11-03 17:35:06 +0200 |
| Language: | C++ (C++11) |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'bool isClear(std::string)':
input/code.cpp:10:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
10 | for(int i=0;i<s.size();i++){
| ~^~~~~~~~~
input/code.cpp: In function 'std::string solve(std::string)':
input/code.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
20 | for(int i=0;i<s.size();i++){//O(n)
| ~^~~~~~~~~
input/code.cpp:24:33: error: expected ';' before '}' token
24 | vst=true
| ^
| ;
25 | }
| ~Code
#include<bits/stdc++.h>
using namespace std;
string str;
bool isDigit(char c){
return c>='0'&&c<='9';
}
bool isClear(string s){
for(int i=0;i<s.size();i++){
if(isDigit(s[i]))return false;
}
return true;
}
bool vst=false;
string solve(string s){
string result="";
for(int i=0;i<s.size();i++){//O(n)
if(isDigit(s[i])&&!vst){
int m=s[i]-'0';
result+=s.substr(i+1,m);
vst=true
}
else{
result+=s[i];
}
}
return result;
}
int main(){
cin>>str;
while(!isClear(str)){//O(n)
vst=false;
str=solve(str);
}
cout<<str<<endl;
return 0;
}
