How do you print duplicate characters from a string in C#

C#
x
39
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string str = "Hello World";
char[] ch = str.ToCharArray();
Dictionary<char, int> dic = new Dictionary<char, int>();
for (int i = 0; i < ch.Length; i++)
🤖 Code Explanation
// this code displays how many times each character appears in the string str.

More problems solved in C#



















