Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/10/2010, 19:01
geforcefx
 
Fecha de Ingreso: enero-2008
Ubicación: Oruro
Mensajes: 50
Antigüedad: 16 años, 4 meses
Puntos: 0
Runtime Error SIGSEGV

hola quiero saber que tiene mi codigo para que me salga Runtime Error SIGSEGV, ya que estoy haciendo un problema de tju online contest (http://acm.tju.edu.cn/toj/showp2806.html)y me sale Runtime Error SIGSEGV ,pero en mi pc anda bien con todas la entradas
-------------------------------------------------------------------------------------------------------
#include <iostream>
#include <string>
#include <vector>
using namespace std;
string reemp(string a,string b,string c){
string d;
int max=a.size()-b.size();
for(int i=0;i<=max;i++){
d=a.substr(i,b.size());
if(b.compare(d)==0)
a.replace(i,b.size(),c);
}
return a;
}

int main(){
string a,c,d;
vector <string> cont;
int i;
getline(cin,c);
getline(cin,d);
while(getline(cin,a))
cont.push_back(a);
for(i=0;i<cont.size();i++){
if(cont[i].size()>=c.size())
cont[i]=reemp(cont[i],c,d);
}
i=0;
while(i<cont.size()){
cout<<cont[i]<<endl;
i++;
}
cout<<endl;
return 0;
}
----------------------------------------------------------------------------------------------------
nota:en el problema dice que por linea hasta 1000 caracteres y el string puede contener mas de eso.
bueno espero puedan ayudarme gracias por leer el mensaje.
saludos^^.