from collections import defaultdict



class     _A   :






  def __init__(self   ,				SCREAMING_SNAKE_CASE_   ,				SCREAMING_SNAKE_CASE_	)		->      str:





       '''simple docstring'''





       UpperCamelCase__										=      total  # total no of tasks (N)

       # DP table will have a dimension of (2^M)*N
       # initially all values are set to -1
       UpperCamelCase__										=      [
           [-1 for i in range(total + 1	)] for j in range(2 ** len(SCREAMING_SNAKE_CASE_	)	)
       ]

       UpperCamelCase__										=      defaultdict(SCREAMING_SNAKE_CASE_	)  # stores the list of persons for each task

       # final_mask is used to check if all persons are included by setting all bits
       # to 1
       UpperCamelCase__										=      (1 << len(SCREAMING_SNAKE_CASE_	)) - 1






  def 		_a					(self   ,				SCREAMING_SNAKE_CASE_   ,				SCREAMING_SNAKE_CASE_	)		->      int:





       '''simple docstring'''





       if mask == self.final_mask:
            return 1

       # if not everyone gets the task and no more tasks are available, return 0
       if task_no > self.total_tasks:
            return 0

       # if case already considered
       if self.dp[mask][task_no] != -1:
            return self.dp[mask][task_no]

       # Number of ways when we don't this task in the arrangement
       UpperCamelCase__										=      self.count_ways_until(SCREAMING_SNAKE_CASE_   ,				task_no + 1	)

       # now assign the tasks one by one to all possible persons and recursively
       # assign for the remaining tasks.
       if task_no in self.task:
            for p in self.task[task_no]:
                 # if p is already given a task
                 if mask & (1 << p):
                      continue

                 # assign this task to p and change the mask value. And recursively
                 # assign tasks with the new mask value.
                 total_ways_util += self.count_ways_until(mask | (1 << p)   ,				task_no + 1	)

        # save the value.
       UpperCamelCase__										=      total_ways_util

       return self.dp[mask][task_no]






  def 		_a					(self   ,				SCREAMING_SNAKE_CASE_	)		->      Any:





       '''simple docstring'''





       for i in range(len(SCREAMING_SNAKE_CASE_	)	):
            for j in task_performed[i]:
                 self.task[j].append(SCREAMING_SNAKE_CASE_	)

        # call the function to fill the DP table, final answer is stored in dp[0][1]
       return self.count_ways_until(0   ,				1	)


if __name__ == "__main__":
      __magic_name__								=5  # total no of tasks (the value of N)

      # the list of tasks that can be done by M persons.
      __magic_name__								=[[1, 3, 4], [1, 2, 5], [3, 4]]
      print(
          AssignmentUsingBitmask(task_performed, total_tasks).count_no_of_ways(
              task_performed
          )
      )




from __future__ import annotations

import math
from collections import Counter
from string import ascii_lowercase







def  __UpperCamelCase    (						A							):
     UpperCamelCase__						,       UpperCamelCase__										=      analyze_text(A							)
     UpperCamelCase__										=      list(''' ''' + ascii_lowercase							)
     # what is our total sum of probabilities.
     UpperCamelCase__										=      sum(single_char_strings.values()							)

     # one length string
     UpperCamelCase__										=      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:
               UpperCamelCase__										=      single_char_strings[ch]
               UpperCamelCase__										=      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
     UpperCamelCase__										=      sum(two_char_strings.values()							)
     UpperCamelCase__										=      0
     # for each alpha (two in size) calculate entropy.
     for cha in my_alphas:
          for cha in my_alphas:
               UpperCamelCase__										=      cha + cha
               if sequence in two_char_strings:
                    UpperCamelCase__										=      two_char_strings[sequence]
                    UpperCamelCase__										=      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  __UpperCamelCase    (						A							):
     UpperCamelCase__										=      Counter()  # type: ignore
     UpperCamelCase__										=      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  __UpperCamelCase    (						):
     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()



