Please either format your code or link to your submission - the forum software has mangled it and it won’t compile! ![]()
Edit:
It’s because you’re trying to place chars at the ith index of s1 for i = 0 … n:
for(i=0;i<n;i++){
cin>>s1[i];
}
when s1 is empty.