Note This Program Is written in C#
class Program
{
static void Main(string[] args)
{
string list1, list2;
list1 = Console.ReadLine().ToString();
list2 = Console.ReadLine().ToString();
string[] array1 = list1.Split(',');
string[] array2 = list2.Split(',');
for (int i = 0; i < array1.Length; i++)
{
string value = array1[i];
int count = 0;
for (int j = 0; j < array2.Length; j++)
{
if (value == array2[j])
{
count++;
}
}
Console.WriteLine(value + "-" + count);
}
}
}
Output:-
If you have More Questions Please Write in Comments
Post a Comment