<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="270246" data-post-id="270246">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mcrumm" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mcrumm/120/23032_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mcrumm
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Phoenix Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks! I made a thing in case anyone else wants to use it:<br>
<a href="https://github.com/mcrumm/req_aoc" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/mcrumm/req_aoc</a></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Mix.install([
  {:req_aoc, github: "mcrumm/req_aoc", ref: "28e3813"}
])

ReqAOC.fetch!({2022, 03, System.fetch_env!("LB_AOC_SESSION")})
# ==&gt; "..."
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270246" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2022-day-3/52217/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-270246" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270246"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="270292" data-post-id="270292">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="stevensonmt" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/stevensonmt/120/20503_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  stevensonmt
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>That’s a fantastic tool! Thanks for sharing. I’m definitely using that to speed up my setup for each day.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270292" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2022-day-3/52217/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-270292" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270292"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="270325" data-post-id="270325">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="ajur58" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ajur58/120/33928_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  ajur58
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-Phoenix-Core-Team" data-username="mcrumm" data-post="6" data-topic="52217">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mcrumm/48/23032_2.png" class="avatar"> mcrumm:</div>
<blockquote>
<p><code>{head, tail} = line |&gt; String.split_at(line |&gt; String.length() |&gt; div(2))</code></p>
</blockquote>
</aside>
<p>I just want to add that for someone being new to Elixir, it’s so cool to do the Advent Of Code riddles, then compare my implementation with yours. Had some funny “AHA!” moments when I’ve discovered stuff like <code>:binary.bin_to_list</code>.</p>
<p>So keep sharing your solutions, even if they seem trivial. I surely appreciate them <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270325" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2022-day-3/52217/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-270325" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270325"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="270328" data-post-id="270328">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tfwright" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tfwright/120/20299_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tfwright
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Didn’t reach for MapSet until the second part. Everyone’s use of codepoints to handle priorities is impressive!</p>
<aside class="onebox githubgist" data-onebox-src="https://gist.github.com/tfwright/f00195bd2c7e6690b19997b9433cee84">
  <header class="source">

      <a href="https://gist.github.com/tfwright/f00195bd2c7e6690b19997b9433cee84" target="_blank" rel="noopener nofollow ugc">gist.github.com</a>
  </header>

  <article class="onebox-body">
    <h4><a href="https://gist.github.com/tfwright/f00195bd2c7e6690b19997b9433cee84" target="_blank" rel="noopener nofollow ugc">https://gist.github.com/tfwright/f00195bd2c7e6690b19997b9433cee84</a></h4>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270328" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2022-day-3/52217/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-270328" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270328"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="270335" data-post-id="270335">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mcrumm" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mcrumm/120/23032_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mcrumm
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Phoenix Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>TIL <a href="https://www.erlang.org/doc/man/binary.html#bin_to_list-1" rel="nofollow">:binary.bin_to_list</a> - There is a ton of cool stuff in the Erlang stdlib it feels like I’m always discovering something new!</p>
<p>I usually don’t do AoC because I convince myself that writing code for work is more important or something, but so far it’s been a nice exercise, I am only optimizing for fun, and I am learning new things!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270335" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2022-day-3/52217/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-270335" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270335"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="270339" data-post-id="270339">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="deadbeef" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  deadbeef
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Same idea as others: <code>MapSet</code>s and intersections. I ended up transforming part 1 into the same problem as part 2, just with a different group size. So they shared the same solving function</p>
<p><a href="https://github.com/ed-flanagan/advent-of-code-solutions-elixir/blob/main/lib/advent/y2022/d03.ex" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/ed-flanagan/advent-of-code-solutions-elixir/blob/main/lib/advent/y2022/d03.ex</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270339" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2022-day-3/52217/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-270339" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270339"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="270355" data-post-id="270355">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="christhekeele" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/christhekeele/120/1039_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  christhekeele
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Same solution as many for part <a href="https://github.com/christhekeele/aoc/commit/c2d5c3753fa5aefacee3436e75296491e3f46c25#diff-5df6d67563e93a6c2cfe2c34dfa449d95fe4dc91965de3e0f9fdbdf83293adfd" rel="noopener nofollow ugc">one</a> and <a href="https://github.com/christhekeele/aoc/commit/c2d5c3753fa5aefacee3436e75296491e3f46c25#diff-d236baa5bd9a8e62c58405383aeab69fcf337faef87ae5e543b7c24f31c2bee9" rel="noopener nofollow ugc">two</a>, using <code>String.codepoints</code> and <code>MapSet.intersection</code>!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270355" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2022-day-3/52217/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-270355" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270355"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="270356" data-post-id="270356">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lkuty" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lkuty/120/34879_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lkuty
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Some ideas from <a class="mention" href="/u/aetherus" rel="nofollow">@Aetherus</a> solution.</p>
<p>part 1</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">start = System.monotonic_time(:microsecond)

File.stream!("input.txt")
|&gt; Stream.map(&amp;String.trim/1)
|&gt; Stream.map(&amp;:binary.bin_to_list/1)
|&gt; Stream.map(&amp;Enum.split(&amp;1, div(length(&amp;1), 2)))
|&gt; Stream.map(fn {f, r} -&gt; hd(f -- f -- r) end)
|&gt; Stream.map(fn
  x when x &gt;= ?a and x &lt;= ?z -&gt; x - ?a + 1
  x when x &gt;= ?A and x &lt;= ?Z -&gt; x - ?A + 27
end)
|&gt; Enum.sum()
|&gt; tap(fn sum -&gt; IO.puts "Sum of priorities: #{sum}" end)

elapsed = System.monotonic_time(:microsecond) - start
IO.puts "Job done in #{elapsed} µs"
</code></pre>
<p>part 2</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">start = System.monotonic_time(:microsecond)

File.stream!("input.txt")
|&gt; Stream.map(&amp;String.trim/1)
|&gt; Stream.map(&amp;:binary.bin_to_list/1)
|&gt; Stream.chunk_every(3)
|&gt; Stream.map(fn [r1, r2, r3] -&gt;
  r = r1 -- (r1 -- r2)
  hd(r3 -- (r3 -- r))
end)
|&gt; Stream.map(fn
  x when x &gt;= ?a and x &lt;= ?z -&gt; x - ?a + 1
  x when x &gt;= ?A and x &lt;= ?Z -&gt; x - ?A + 27
end)
|&gt; Enum.sum()
|&gt; tap(fn sum -&gt; IO.puts "Sum of priorities: #{sum}" end)

elapsed = System.monotonic_time(:microsecond) - start
IO.puts "Job done in #{elapsed} µs"
</code></pre>
<p>I then decided to benchmark it with benchee. I guess that reading the file many times puts it in some sort of cache and thus the execution times are well below the one with a single execution dominated by I/O. Part 1 without benchee gives ± 7 ms but with benchee an average of 0.86 ms <img src="https://forum.elixirforum.com/images/emoji/apple/thinking.png?v=15" title=":thinking:" class="emoji" alt=":thinking:" loading="lazy" width="20" height="20"></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Mix.install([
  {:benchee, "~&gt; 1.1.0"},
])

Benchee.run(%{"run" =&gt; fn -&gt;
  File.stream!("input.txt")
  |&gt; Stream.map(&amp;String.trim/1)
  |&gt; Stream.map(&amp;:binary.bin_to_list/1)
  |&gt; Stream.map(&amp;Enum.split(&amp;1, div(length(&amp;1), 2)))
  |&gt; Stream.map(fn {f, r} -&gt; hd(f -- f -- r) end)
  |&gt; Stream.map(fn
    x when x &gt;= ?a and x &lt;= ?z -&gt; x - ?a + 1
    x when x &gt;= ?A and x &lt;= ?Z -&gt; x - ?A + 27
  end)
  |&gt; Enum.sum()
end})
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270356" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2022-day-3/52217/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-270356" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270356"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="270363" data-post-id="270363">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="marcelfahle" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/marcelfahle/120/5539_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  marcelfahle
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Amazing! <img src="https://forum.elixirforum.com/images/emoji/apple/exploding_head.png?v=15" title=":exploding_head:" class="emoji" alt=":exploding_head:" loading="lazy" width="20" height="20"> I’ve learned a lot from this, thanks for sharing..</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270363" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2022-day-3/52217/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-270363" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270363"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="270364" data-post-id="270364">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="marcelfahle" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/marcelfahle/120/5539_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  marcelfahle
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yea ok there are some elegant solutions in here, wow <img src="https://forum.elixirforum.com/images/emoji/apple/exploding_head.png?v=15" title=":exploding_head:" class="emoji" alt=":exploding_head:" loading="lazy" width="20" height="20">  Made me almost not post mine <img src="https://forum.elixirforum.com/images/emoji/apple/see_no_evil.png?v=15" title=":see_no_evil:" class="emoji" alt=":see_no_evil:" loading="lazy" width="20" height="20"><br>
Regardless, I had some fun with and learned about String.myers_difference and Enum.frequencies <img src="https://forum.elixirforum.com/images/emoji/apple/smile.png?v=15" title=":smile:" class="emoji" alt=":smile:" loading="lazy" width="20" height="20"></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule ExAOC2022.Day3 do
  @input "./lib/day3_input.txt"

  def puzzle1() do
    prio = priority_map([?a..?z, ?A..?Z])

    @input
    |&gt; file_by_line()
    |&gt; Enum.map(&amp;by_compartment/1)
    |&gt; Enum.map(&amp;eq/1)
    |&gt; Enum.map(&amp;Keyword.get(prio, String.to_atom(&amp;1)))
    |&gt; Enum.sum()
  end

  def puzzle2() do
    prio = priority_map([?a..?z, ?A..?Z])

    @input
    |&gt; file_by_line()
    |&gt; Enum.chunk_every(3)
    |&gt; Enum.map(&amp;find_common_chars/1)
    |&gt; Enum.map(&amp;Keyword.get(prio, String.to_atom(&amp;1)))
    |&gt; Enum.sum()
  end

  # PRIVATE SHENANIGANS
  defp by_compartment(content) do
    mid_len = content |&gt; String.length() |&gt; div(2)

    content |&gt; String.split_at(mid_len)
  end

  defp eq({str1, str2}), do: String.myers_difference(str1, str2)[:eq]

  defp find_common_chars(list_of_strings) do
    list_of_strings
    |&gt; Enum.map(&amp;uniq/1)
    |&gt; Enum.join()
    |&gt; String.graphemes()
    |&gt; Enum.frequencies()
    |&gt; Map.filter(fn {_k, v} -&gt; v == 3 end)
    |&gt; Map.keys()
    |&gt; List.first()
  end

  defp uniq(str) do
    str
    |&gt; String.graphemes()
    |&gt; Enum.uniq()
    |&gt; Enum.join()
  end

  defp priority_map(ranges) do
    ranges
    |&gt; Enum.map(&amp;priority/1)
    |&gt; Enum.concat()
    |&gt; Enum.with_index(1)
  end

  defp priority(range) do
    range
    |&gt; Enum.map(&amp;String.to_atom(&lt;&lt;&amp;1::utf8&gt;&gt;))
  end

  defp file_by_line(file) do
    file
    |&gt; File.read!()
    |&gt; String.split(~r/\R/, trim: true)
  end
end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270364" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2022-day-3/52217/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-270364" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270364"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/52217/load_more?page=3">Load more posts (16 remaining)</a>
</div></template></turbo-stream>