Skip to content

Instantly share code, notes, and snippets.

@jz5
Last active April 12, 2020 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jz5/86a8b9f93a5757e8741d2b909a6758a2 to your computer and use it in GitHub Desktop.
Save jz5/86a8b9f93a5757e8741d2b909a6758a2 to your computer and use it in GitHub Desktop.
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