Given two strings like x=?hello? and y=?open?, remove any
character from string x which is also used in string y,
thus making the result x=?hll?.

Answer Posted / preeti

Lttle correction in above answer.

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string str = "mohim";
string str1 = "mo";
remove(str, str1);
}
private static void remove(string str,string str1)
{
char[] abc;
abc = str.ToCharArray();
char[] bcd;
string str4 = "";
bcd = str1.ToCharArray();
for (int i = 0; i < bcd.Length; i++)
{
for (int j = 0; j < abc.Length; j++)
{
if (abc[j] != bcd[i])
{

str4 = str4 + abc[j];
}
}
abc = str4.ToCharArray();
str4 = "";
}

str = "";
for (int j = 0; j < abc.Length; j++)
{

str = str + abc[j];

}

Console.Write("str : ");
Console.Write(str)
}
}
}

output will be
------------------------

str : hi

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Will I be able to get a picture in D drive to the c++ program? If so, help me out?

1671


How can you overcome the diamond problem in inheritance?

779


What is solid in oops?

623


Who invented oop?

663


Write a program to sort the number with different sorts in one program ??

1926






What makes a language oop?

604


What is polymorphism what are the different types of polymorphism?

573


i got a backdoor offer in process global,Bangalore..Can i work with it?

2339


What does sksksk mean in text slang?

1547


Get me an image implementation program.

1569


What is inheritance in simple words?

631


What causes polymorphism?

585


What is the difference between a constructor and a destructor?

623


What is abstraction encapsulation?

667


Why is destructor used?

589