I tried to run this program in Visual stdio and used WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB
as input. After running it, it's showing Segmentation fault (core dumped).
How to solve this?
#include <stdio.h>
#include <string.h>
int main()
{
char string[201];
int i, j;
scanf("%s",string);
for(i=0;i<strlen(string); i++){
if(string[i]=='W' && string[i+1]=='U' && string[i+2]=='B'){
for(int k=i; k<i+3; k++){
string[k]='o';
i=i+2;
}
}
}
puts (string);
}
I want to know whats wrong with my program here