





"""simple docstring"""
from __future__ import annotations

import math
from collections import Counter
from string import ascii_lowercase



def      __lowerCamelCase   (							a_     :		str							)			->      None:
      __SCREAMING_SNAKE_CASE				,__SCREAMING_SNAKE_CASE   :Any						=  analyze_text(a_							)
      __SCREAMING_SNAKE_CASE   :Optional[int]						=  list(''' ''' + ascii_lowercase							)
      # what is our total sum of probabilities.
      __SCREAMING_SNAKE_CASE   :Optional[int]						=  sum(single_char_strings.values()							)

      # one length string
      __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  0
      # for each alpha we go in our dict and if it is in it we calculate entropy
      for ch in my_alphas:
            if ch in single_char_strings:
                  __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  single_char_strings[ch]
                  __SCREAMING_SNAKE_CASE   :Any						=  my_str / all_sum
                  my_fir_sum += prob * math.loga(a_							)  # entropy formula.

    # print entropy
      print(f'''{round(-1 * my_fir_sum							):.1f}'''							)

      # two len string
      __SCREAMING_SNAKE_CASE   :str						=  sum(two_char_strings.values()							)
      __SCREAMING_SNAKE_CASE   :str						=  0
      # for each alpha (two in size) calculate entropy.
      for cha in my_alphas:
            for cha in my_alphas:
                  __SCREAMING_SNAKE_CASE   :List[Any]						=  cha + cha
                  if sequence in two_char_strings:
                        __SCREAMING_SNAKE_CASE   :Any						=  two_char_strings[sequence]
                        __SCREAMING_SNAKE_CASE   :Dict						=  int(a_							) / all_sum
                        my_sec_sum += prob * math.loga(a_							)

    # print second entropy
      print(f'''{round(-1 * my_sec_sum							):.1f}'''							)

      # print the difference between them
      print(f'''{round((-1 * my_sec_sum) - (-1 * my_fir_sum)							):.1f}'''							)



def      __lowerCamelCase   (							a_     :		str							)			->      tuple[dict, dict]:
      __SCREAMING_SNAKE_CASE   :Optional[Any]						=  Counter()  # type: ignore
      __SCREAMING_SNAKE_CASE   :List[str]						=  Counter()  # type: ignore
      single_char_strings[text[-1]] += 1

      # first case when we have space at start.
      two_char_strings[" " + text[0]] += 1
      for i in range(0 ,   len(a_							) - 1							):
            single_char_strings[text[i]] += 1
            two_char_strings[text[i : i + 2]] += 1
      return single_char_strings, two_char_strings



def      __lowerCamelCase   (							)			->      Optional[Any]:
      import doctest

      doctest.testmod()
      # text = (
      #     "Had repulsive dashwoods suspicion sincerity but advantage now him. Remark "
      #     "easily garret nor nay. Civil those mrs enjoy shy fat merry. You greatest "
      #     "jointure saw horrible. He private he on be imagine suppose. Fertile "
      #     "beloved evident through no service elderly is. Blind there if every no so "
      #     "at. Own neglected you preferred way sincerity delivered his attempted. To "
      #     "of message cottage windows do besides against uncivil.  Delightful "
      #     "unreserved impossible few estimating men favourable see entreaties. She "
      #     "propriety immediate was improving. He or entrance humoured likewise "
      #     "moderate. Much nor game son say feel. Fat make met can must form into "
      #     "gate. Me we offending prevailed discovery. "
      # )

      # calculate_prob(text)


if __name__ == "__main__":
  main()






"""simple docstring"""
from manim import *






class 					_SCREAMING_SNAKE_CASE(   A  ):




       def     _UpperCamelCase     (						self							)			->      str:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE   :Optional[Any]						=  Rectangle(height=0.5		,width=0.5							)
             __SCREAMING_SNAKE_CASE   :List[str]						=  Rectangle(height=0.4_6		,width=0.4_6							).set_stroke(width=0							)

             __SCREAMING_SNAKE_CASE   :List[str]						=  [mem.copy() for i in range(6							)]
             __SCREAMING_SNAKE_CASE   :List[str]						=  [mem.copy() for i in range(6							)]
             __SCREAMING_SNAKE_CASE   :Optional[int]						=  VGroup(*SCREAMING_SNAKE_CASE__							).arrange(SCREAMING_SNAKE_CASE__		,buff=0							)
             __SCREAMING_SNAKE_CASE   :Optional[Any]						=  VGroup(*SCREAMING_SNAKE_CASE__							).arrange(SCREAMING_SNAKE_CASE__		,buff=0							)
             __SCREAMING_SNAKE_CASE   :Any						=  VGroup(SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							).arrange(SCREAMING_SNAKE_CASE__		,buff=0							)
             __SCREAMING_SNAKE_CASE   :Tuple						=  Text('''CPU'''		,font_size=24							)
             __SCREAMING_SNAKE_CASE   :Optional[Any]						=  Group(SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							).arrange(SCREAMING_SNAKE_CASE__		,buff=0.5		,aligned_edge=SCREAMING_SNAKE_CASE__							)
             cpu.move_to([-2.5, -0.5, 0]							)
             self.add(SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE   :List[Any]						=  [mem.copy() for i in range(1							)]
             __SCREAMING_SNAKE_CASE   :str						=  VGroup(*SCREAMING_SNAKE_CASE__							).arrange(SCREAMING_SNAKE_CASE__		,buff=0							)
             __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  Text('''GPU'''		,font_size=24							)
             __SCREAMING_SNAKE_CASE   :int						=  Group(SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							).arrange(SCREAMING_SNAKE_CASE__		,buff=0.5		,aligned_edge=SCREAMING_SNAKE_CASE__							)
             gpu.align_to(SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							)
             gpu.set_x(gpu.get_x() - 1							)

             self.add(SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE   :str						=  [mem.copy() for i in range(6							)]
             __SCREAMING_SNAKE_CASE   :int						=  VGroup(*SCREAMING_SNAKE_CASE__							).arrange(SCREAMING_SNAKE_CASE__		,buff=0							)

             __SCREAMING_SNAKE_CASE   :List[Any]						=  Text('''Model'''		,font_size=24							)
             __SCREAMING_SNAKE_CASE   :int						=  Group(SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							).arrange(SCREAMING_SNAKE_CASE__		,buff=0.5		,aligned_edge=SCREAMING_SNAKE_CASE__							)
             model.move_to([3, -1.0, 0]							)

             self.play(
                 Create(SCREAMING_SNAKE_CASE__		,run_time=1							)		,Create(SCREAMING_SNAKE_CASE__		,run_time=1							)		,Create(SCREAMING_SNAKE_CASE__		,run_time=1							)		,)

             __SCREAMING_SNAKE_CASE   :List[str]						=  MarkupText(
                 f'''First, an empty model skeleton is loaded\ninto <span fgcolor=\'{YELLOW}\'>memory</span> without using much RAM.'''		,font_size=24		,)

             __SCREAMING_SNAKE_CASE   :List[Any]						=  Square(side_length=2.2							)
             key.move_to([-5, 2, 0]							)

             __SCREAMING_SNAKE_CASE   :Optional[Any]						=  MarkupText(
                 f'''<b>Key:</b>\n\n<span fgcolor=\'{YELLOW}\'>●</span> Empty Model'''		,font_size=18		,)

             key_text.move_to([-5, 2.4, 0]							)

             step_a.move_to([2, 2, 0]							)
             self.play(Write(SCREAMING_SNAKE_CASE__		,run_time=2.5							)		,Write(SCREAMING_SNAKE_CASE__							)		,Write(SCREAMING_SNAKE_CASE__							)							)

             self.add(SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  []
             __SCREAMING_SNAKE_CASE   :int						=  []
             __SCREAMING_SNAKE_CASE   :List[Any]						=  []
             for i, rect in enumerate(SCREAMING_SNAKE_CASE__							):
                   __SCREAMING_SNAKE_CASE   :Any						=  Rectangle(height=0.4_6		,width=0.4_6							).set_stroke(width=0.0							).set_fill(SCREAMING_SNAKE_CASE__		,opacity=0.7							)
                   cpu_target.move_to(SCREAMING_SNAKE_CASE__							)
                   cpu_target.generate_target()
                   __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  0.4_6 / 4
                   __SCREAMING_SNAKE_CASE   :Tuple						=  0.4_6 / 3

                   if i == 0:
                         cpu_target.target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT							)		,buff=0.0_2		,direction=SCREAMING_SNAKE_CASE__							)
                         cpu_target.target.set_x(cpu_target.target.get_x() + 0.1							)
                   elif i == 3:
                         cpu_target.target.next_to(cpu_targs[0].target		,direction=SCREAMING_SNAKE_CASE__		,buff=0.0							)
                   else:
                         cpu_target.target.next_to(cpu_targs[i - 1].target		,direction=SCREAMING_SNAKE_CASE__		,buff=0.0							)
                   cpu_targs.append(SCREAMING_SNAKE_CASE__							)

                   first_animations.append(rect.animate(run_time=0.5							).set_stroke(SCREAMING_SNAKE_CASE__							)							)
                   second_animations.append(MoveToTarget(SCREAMING_SNAKE_CASE__		,run_time=1.5							)							)

             self.play(*SCREAMING_SNAKE_CASE__							)
             self.play(*SCREAMING_SNAKE_CASE__							)

             self.wait()