Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 30 lines (27 sloc) 0.558 kb
7fb21a5 Anoop.S.M first commit
authored
1 /* Write a function squeeze(s1,s2) that deletes each character in s1 that
2 matches any character in the string s2. */
3
4 #include<stdio.h>
5 #define MAX 100
6 void squeeze(char s1[],char s2[]);
7 main()
8 {
9 char s1[MAX], s2[MAX];
10 printf("Enter first string : ");
11 scanf("%s",s1);
12 printf("Enter second string : ");
13 scanf("%s",s2);
14 squeeze(s1,s2);
15 }
16
17 void squeeze(char s1[],char s2[])
18 {
19 int i,j,k;
20 char s3[MAX];
21 for(i=j=0; s1[i]!='\0'; ++i){
22 for(k=0;s2[k]!='\0';++k)
23 if(s1[i]==s2[k])
24 ++i;
25 s3[j++]=s1[i];
26 }
27 s3[j]='\0';
28 printf("Result : %s\n",s3);
29 }
Something went wrong with that request. Please try again.