Last active
April 12, 2020 15:05
-
-
Save jz5/86a8b9f93a5757e8741d2b909a6758a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
var lines = File.ReadAllLines(@"ナンバープレート一覧.csv", Encoding.UTF8).ToList(); | |
var places = lines.Skip(1).Select(x => x.Split(',')[2]); | |
var chars = new List<char>(); | |
var charHashSet = new HashSet<char>(); | |
foreach (var name in places) | |
{ | |
chars.AddRange(name.ToCharArray()); | |
foreach (var c in name) | |
{ | |
if (charHashSet.Contains(c)) | |
continue; | |
charHashSet.Add(c); | |
} | |
} | |
File.WriteAllText("chars.txt", string.Join("", charHashSet.ToList().OrderBy(x => x)), Encoding.UTF8); | |
File.WriteAllText("chars_rank.txt", string.Join("\r\n", chars.GroupBy(x => x).OrderByDescending(y => y.Count()).ThenBy(y => y.Key).Select(y => $"{y.Key}\t{y.Count()}")), Encoding.UTF8); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment