Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
First Non repeat char
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { String str = "aaa b bdd h aaa k "; char ch = firstNonRepeatedChar(str); } public static char firstNonRepeatedChar(String str) { Dictionary<char,int> dict = new Dictionary<char,int>(); dict.Add(str[0],1); for(int i=1; i< str.Length; i++) { if(dict.ContainsKey(str[i])) dict[str[i]]++; else dict.Add(str[i],1); } foreach (KeyValuePair<char,int> keypair in dict) { if(keypair.Value==1) { Console.Write(keypair.Key); return keypair.Key; break; } } return ' '; } } }
run
|
edit
|
history
|
help
0
((((STReaming))))%^%% The 2022 RBC Canadian Open Golf PGA Tour event
//Json Get Field from Array
Recur5
Two lines of Random number
int-float C# division
double to hex to double lose precision
Better Random number blocks
a
BFS ALGO
Multithreading