Skip to content

Commit

Permalink
Merge pull request tanus786#747 from SonuKushwaha-hub/patch-6
Browse files Browse the repository at this point in the history
Create Character Stuffing
  • Loading branch information
tanus786 authored Oct 29, 2022
2 parents 80d2337 + c2a543a commit dfee4b6
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Character Stuffing
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include<bits/stdc++.h>
using namespace std;
int main()
{
char so[100],data[100];
cout<<"Enter the text: ";
cin>>so;
char flag,bit;
cout<<"enter the flag: ";
cin>>flag;
cout<<"enter the character: ";
cin>>bit;

int size=strlen(so);
data[0]=flag;
int i,j;
for(i=0,j=1;i<size;i++)
{
if(so[i]==bit)
{
data[j]=so[i];
j++;
data[j]='k';
j++;

}
else{
data[j]=so[i];
j++;
}
}
data[j]=flag;
data[j+1]='\0';
cout<<data;
return 0;
}

0 comments on commit dfee4b6

Please sign in to comment.