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 / jethvamohit
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 = "";
}
Console.Write(abc);
Console.ReadLine();
}
}
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What is the renewal class?
Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)
What is and I oop mean?
What is inheritance in simple words?
Please send ford technologies placement paper 2 my mail id
What is an example of genetic polymorphism?
What is polymorphism give a real life example?
write knight tour problem which is present in datastructure
what is difference between class template and template class?
Which type does string inherit from?
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
What are the 3 principles of oop?
What is the difference between inheritance and polymorphism?
Can an interface inherit a class?
What are oops functions?