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

What is the difference between abstraction and polymorphism?

840


which feature are not hold visual basic of oop?

1936


Describe these concepts: Polymorphism, Inheritance and Abstraction.

848


Why oops is important?

781


What is polymorphism and types?

827


What is interface? When and where is it used?

1871


What is oops in simple words?

802


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

2568


What is advantage of inheritance?

924


Why do we need polymorphism in c#?

873


What are oops functions?

777


What is the difference between inheritance and polymorphism?

786


what is difference between class template and template class?

2389


How is polymorphism achieved?

766


to find out the minimum of two integer number of two different classes using friend function

1865