





"""simple docstring"""




from __future__ import annotations

import math
from collections import Counter
from string import ascii_lowercase





def 	a_    (							_lowercase       ):
						_UpperCamelCase       ,							_UpperCamelCase      : int         =   analyze_text(_lowercase       )
						_UpperCamelCase      : str         =   list(''' ''' + ascii_lowercase       )
						# what is our total sum of probabilities.
						_UpperCamelCase      : Union[str, Any]         =   sum(single_char_strings.values()       )

						# one length string
						_UpperCamelCase      : Optional[int]         =   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      : Union[str, Any]         =   single_char_strings[ch]
																		_UpperCamelCase      : List[Any]         =   my_str / all_sum
																		my_fir_sum += prob * math.loga(_lowercase       )  # entropy formula.

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

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

    # 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 	a_    (							_lowercase       ):
						_UpperCamelCase      : Optional[Any]         =   Counter()  # type: ignore
						_UpperCamelCase      : Tuple         =   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(_lowercase       ) - 1       ):
												single_char_strings[text[i]] += 1
												two_char_strings[text[i : i + 2]] += 1
						return single_char_strings, two_char_strings





def 	a_    (							):
						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"""




class 			_a						:






				def __init__(			self		:   Optional[int],			lowerCAmelCase__		:   list							)     ->				None:




										'''simple docstring'''



										_UpperCamelCase      : Optional[int]         =   set_counts
										_UpperCamelCase      : Any         =   max(lowerCAmelCase__							)
										_UpperCamelCase      : int         =   len(lowerCAmelCase__							)
										_UpperCamelCase      : int         =   [1] * num_sets
										_UpperCamelCase      : List[Any]         =   list(range(lowerCAmelCase__							)							)






				def     snake_case     (			self		:   int,			lowerCAmelCase__		:   int,			lowerCAmelCase__		:   int							)     ->				bool:




										'''simple docstring'''



										_UpperCamelCase      : Optional[Any]         =   self.get_parent(lowerCAmelCase__							)
										_UpperCamelCase      : Any         =   self.get_parent(lowerCAmelCase__							)

										if src_parent == dst_parent:
																return False

										if self.ranks[dst_parent] >= self.ranks[src_parent]:
																self.set_counts[dst_parent] += self.set_counts[src_parent]
																_UpperCamelCase      : List[Any]         =   0
																_UpperCamelCase      : str         =   dst_parent
																if self.ranks[dst_parent] == self.ranks[src_parent]:
																						self.ranks[dst_parent] += 1
																_UpperCamelCase      : Union[str, Any]         =   self.set_counts[dst_parent]
										else:
																self.set_counts[src_parent] += self.set_counts[dst_parent]
																_UpperCamelCase      : Tuple         =   0
																_UpperCamelCase      : Optional[Any]         =   src_parent
																_UpperCamelCase      : int         =   self.set_counts[src_parent]

										_UpperCamelCase      : Optional[Any]         =   max(self.max_set,			lowerCAmelCase__							)
										return True






				def     snake_case     (			self		:   Optional[Any],			lowerCAmelCase__		:   int							)     ->				int:




										'''simple docstring'''



										if self.parents[disj_set] == disj_set:
																return disj_set
										_UpperCamelCase      : Union[str, Any]         =   self.get_parent(self.parents[disj_set]							)
										return self.parents[disj_set]



