site : http://www.spoj.com/problems/GNY07A/
Language : C++
my solution : https://ideone.com/ExrR7X
#include <iostream
#include <string
using namespace std;
int main()
{
long int T,t,n,a,x,b;
string str1,str2;
cin >> T;
for (t=1; t<=T; t++)
{
cin >> n;
n–;
cin >> str1;
a = str1.length();
b = 0;
for (x=0; x<a; x++)
{
if (x != n)
{
str2[b] = str1[x];
b++;
}
}
cout << t << " ";
for (b=0; b < a-1; b++)
{
cout << str2[b];
}
cout << “\n”;
}
}
Note: I put on the 2 last > in #include iostream and string but didn’t put it there because somehow it disappears when I put it here.
I got runtime error (SIGSEGV). Can anyone tell me why does it give an error and how to fix it? It went ok in Ideone. Thx