





from __future__ import annotations

import math
from collections import Counter
from string import ascii_lowercase


def       UpperCamelCase__(			UpperCamelCase__     :			str    )->None:
       A__   ,      A__		   =		analyze_text(UpperCamelCase__    )
       A__		   =		list(''' ''' + ascii_lowercase    )
       # what is our total sum of probabilities.
       A__		   =		sum(single_char_strings.values()    )

       # one length string
       A__		   =		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:
                     A__		   =		single_char_strings[ch]
                     A__		   =		my_str / all_sum
                     my_fir_sum += prob * math.loga(UpperCamelCase__    )  # entropy formula.

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

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

    # 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__(			UpperCamelCase__     :			str    )->tuple[dict, dict]:
       A__		   =		Counter()  # type: ignore
       A__		   =		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(UpperCamelCase__    ) - 1    ):
              single_char_strings[text[i]] += 1
              two_char_strings[text[i : i + 2]] += 1
       return single_char_strings, two_char_strings


def       UpperCamelCase__(			)->Union[str, 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()












def       UpperCamelCase__(			UpperCamelCase__     :			str					,	UpperCamelCase__     :			str    )->str:
       assert x is not None
       assert y is not None

       A__		   =		len(UpperCamelCase__    )
       A__		   =		len(UpperCamelCase__    )

       # declaring the array for storing the dp values
       A__		   =		[[0] * (n + 1) for _ in range(m + 1    )]  # noqa: E741

       for i in range(1					,	m + 1    ):
              for j in range(1					,	n + 1    ):
                     A__		   =		1 if x[i - 1] == y[j - 1] else 0

                     A__		   =		max(l[i - 1][j]					,	l[i][j - 1]					,	l[i - 1][j - 1] + match    )

       A__		   =		''''''
       A__   ,      A__		   =		m, n
       while i > 0 and j > 0:
              A__		   =		1 if x[i - 1] == y[j - 1] else 0

              if l[i][j] == l[i - 1][j - 1] + match:
                     if match == 1:
                            A__		   =		x[i - 1] + seq
                     i -= 1
                     j -= 1
              elif l[i][j] == l[i - 1][j]:
                     i -= 1
              else:
                     j -= 1

       return l[m][n], seq


if __name__ == "__main__":
       a__: Tuple							   =						'AGGTAB'
       a__: Tuple							   =						'GXTXAYB'
       a__: List[Any]							   =						4
       a__: Optional[Any]							   =						'GTAB'

       a__   ,     a__: List[str]							   =						longest_common_subsequence(a, b)
       print('len =', ln, ', sub-sequence =', subseq)
       import doctest

       doctest.testmod()





