#include<stdio.h>
#include<string.h>
int main()
{
char a[1010], b[1010];
int i, j, n, m, l;
while(gets(a) && gets(b))
{
char c[1010], u;
i = j = n = m = l = 0;
n = strlen(a);
m = strlen(b);
for(i=0;i<n;i++)
{
j = 0;
while(a[i] != b[j] && j<m)
{
j++;
}
if(j != m && b[j] != 32)
{
c[l] = b[j];
b[j] = '\0';
l++;
}
}
c[l] = '\0';
for(i=0;i<l-1;i++)
{
for(j=0;j<l-i-1;j++)
{
if(c[j]>c[j+1])
{
u = c[j];
c[j] = c[j+1];
c[j+1] = u;
}
}
}
printf("%s\n", c);
}
return 0;
}
#include<string.h>
int main()
{
char a[1010], b[1010];
int i, j, n, m, l;
while(gets(a) && gets(b))
{
char c[1010], u;
i = j = n = m = l = 0;
n = strlen(a);
m = strlen(b);
for(i=0;i<n;i++)
{
j = 0;
while(a[i] != b[j] && j<m)
{
j++;
}
if(j != m && b[j] != 32)
{
c[l] = b[j];
b[j] = '\0';
l++;
}
}
c[l] = '\0';
for(i=0;i<l-1;i++)
{
for(j=0;j<l-i-1;j++)
{
if(c[j]>c[j+1])
{
u = c[j];
c[j] = c[j+1];
c[j+1] = u;
}
}
}
printf("%s\n", c);
}
return 0;
}
Comments
Post a Comment