# MinMaxString problem division 2

Well, in today’s contest i tried to solve the string problem, but my code failed bcs it exceded the time limit. Can someone tell me how i can make the code execute faster?

This is my code btw.

`````` #include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#include <string>

using namespace std;

bool isprefix(string a, string b){
if(a.size() >= b.size()) return false;
for(int i = 0; i < a.size(); i++){
if(a[i] != b[i]){
return false;
}
}
return true;
}

int main()
{
int cases; cin>> cases;
while(cases > 0){
cin.get();
string str;
getline(cin,str);
}
vector <int> numbers;
for(int i = 0; i < entrada.size(); i++){
bool pref = false;
for(int j = 0; j < entrada.size(); j++){
if(i != j){
pref = true;
break;
}
}
}
if(!pref) numbers.push_back(i);
}
int q; cin>>q;
cin.get();
while(q > 0){
string str;
getline(cin,str);
if(str[0] == '1'){
int a = str[2]-'0';
int i;
for(i = 3; str[i]>= 48 && str[i]<= 57; i++){
a = 10*a + (str[i]-'0');
}
for(int i = 0; i < numbers.size(); i++){
numbers.erase(numbers.begin()+i);
}
}
bool pref = false;
for(int i = 0; i < entrada.size(); i++){
pref = true;
break;
}
}
}
else if(str[0] == '2'){

for(int i = 0; i < numbers.size()-1; i++){
}
int r;
for(r = 0; r < entrada.size(); r++){
break;
}
}
cout<<r+1<<endl;
}
else{
for(int i = 0; i < numbers.size()-1; i++){
}
int r;
for(r = 0; r < entrada.size(); r++){