12
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ElixirAdvent Calendar 2023

Day 2

言語聴覚リハビリ答えあわせプログラム 〜数字、仮名ソート〜

Last updated at Posted at 2023-12-01

今年は入院しながらQiita書きます
入院中課題の答え合わせです

課題

  • 数字→仮名
  • 数字は小さい順
  • 仮名は50音順

プログラム

defmodule P1 do
  def run(), do: Enum.each(data(), fn x -> sort(x) end)

  def sort(v) do
    String.split(v, " ")
    |> Enum.sort()
    |> Enum.join()
    |> IO.inspect()
  end

  def data do
    [
      "5 き 1 さ 3",
      "4 つ 2 そ 1",
      "6 よ 3 ふ 8",
      "9 め 3 れ 2 た",
      "2 し 1 は 6 か",
      "7 く 9 ね 2 を",
      "1 お 3 ろ 5 て 4 ",
      "2 ひ 1 も 6 る 3 ",
      "4 む 8 せ 6 ら 7 ぬ",
      "6 ゆ 2 り 5 こ 4 の"
    ]
  end
end

結果

"135きさ"
"124そつ"
"368ふよ"
"239ためれ"
"126かしは"
"279くねを"
"1345おてろ"
"1236ひもる"
"4678せぬむら"
"2456このゆり"

余談 なぜ、入院した?

  • くも膜下出血しました
     脳の手術しました
  • 失語症なりました
      リハビリの為、上記課題を実施してます
     (これは、リハビリの一部です)
12
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?