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

Which language is not a true object oriented programming language?

634


what type of questions

1691


Get me an image implementation program.

1557


what is different between oops and c++

1998


What is difference between class and object with example?

560






Can enum be null?

582


can we make game by using c

3411


Why is encapsulation used?

577


What does no cap mean?

590


What is object in oops?

608


What is polymorphism and its types?

588


How to hide the base class functionality in Inheritance?

634


What are objects in oop?

604


I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...

1622


when to use 'mutable' keyword and when to use 'const cast' in c++

1642