






"""simple docstring"""





from __future__ import annotations

_SCREAMING_SNAKE_CASE					:				Optional[int]					    =						tuple[int, int, int]
_SCREAMING_SNAKE_CASE					:				Dict					    =						tuple[str, str, str]


# used alphabet --------------------------
# from string.ascii_uppercase
_SCREAMING_SNAKE_CASE					:				str					    =						'''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''

# -------------------------- default selection --------------------------
# rotors --------------------------
_SCREAMING_SNAKE_CASE					:				int					    =						'''EGZWVONAHDCLFQMSIPJBYUKXTR'''
_SCREAMING_SNAKE_CASE					:				Optional[int]					    =						'''FOBHMDKEXQNRAULPGSJVTYICZW'''
_SCREAMING_SNAKE_CASE					:				List[Any]					    =						'''ZJXESIUQLHAVRMDOYGTNFWPBKC'''
# reflector --------------------------
_SCREAMING_SNAKE_CASE					:				str					    =						{
    '''A''': '''N''',
    '''N''': '''A''',
    '''B''': '''O''',
    '''O''': '''B''',
    '''C''': '''P''',
    '''P''': '''C''',
    '''D''': '''Q''',
    '''Q''': '''D''',
    '''E''': '''R''',
    '''R''': '''E''',
    '''F''': '''S''',
    '''S''': '''F''',
    '''G''': '''T''',
    '''T''': '''G''',
    '''H''': '''U''',
    '''U''': '''H''',
    '''I''': '''V''',
    '''V''': '''I''',
    '''J''': '''W''',
    '''W''': '''J''',
    '''K''': '''X''',
    '''X''': '''K''',
    '''L''': '''Y''',
    '''Y''': '''L''',
    '''M''': '''Z''',
    '''Z''': '''M''',
}

# -------------------------- extra rotors --------------------------
_SCREAMING_SNAKE_CASE					:				Any					    =						'''RMDJXFUWGISLHVTCQNKYPBEZOA'''
_SCREAMING_SNAKE_CASE					:				Tuple					    =						'''SGLCPQWZHKXAREONTFBVIYJUDM'''
_SCREAMING_SNAKE_CASE					:				Any					    =						'''HVSICLTYKQUBXDWAJZOMFGPREN'''
_SCREAMING_SNAKE_CASE					:				Dict					    =						'''RZWQHFMVDBKICJLNTUXAGYPSOE'''
_SCREAMING_SNAKE_CASE					:				int					    =						'''LFKIJODBEGAMQPXVUHYSTCZRWN'''
_SCREAMING_SNAKE_CASE					:				Dict					    =						'''KOAEGVDHXPQZMLFTYWJNBRCIUS'''







def      lowerCamelCase__       (							_lowerCamelCase       :		RotorPositionT		,				_lowerCamelCase       :		RotorSelectionT		,				_lowerCamelCase       :		str )      ->				tuple[RotorPositionT, RotorSelectionT, dict[str, str]]:
  # Checks if there are 3 unique rotors

  if (unique_rotsel := len(set(_lowerCamelCase ) )) < 3:
    lowerCamelCase_         =						F'''Please use 3 unique rotors (not {unique_rotsel})'''
    raise Exception(_lowerCamelCase )

  # Checks if rotor positions are valid
  lowerCamelCase_     ,	lowerCamelCase_     ,	lowerCamelCase_         =						rotpos
  if not 0 < rotorposa <= len(_lowerCamelCase ):
    lowerCamelCase_         =						F'''First rotor position is not within range of 1..26 ({rotorposa}'''
    raise ValueError(_lowerCamelCase )
  if not 0 < rotorposa <= len(_lowerCamelCase ):
    lowerCamelCase_         =						F'''Second rotor position is not within range of 1..26 ({rotorposa})'''
    raise ValueError(_lowerCamelCase )
  if not 0 < rotorposa <= len(_lowerCamelCase ):
    lowerCamelCase_         =						F'''Third rotor position is not within range of 1..26 ({rotorposa})'''
    raise ValueError(_lowerCamelCase )

  # Validates string and returns dict
  lowerCamelCase_         =						_plugboard(_lowerCamelCase )

  return rotpos, rotsel, pbdict







def      lowerCamelCase__       (							_lowerCamelCase       :		str )      ->				dict[str, str]:

  # tests the input string if it
  # a) is type string
  # b) has even length (so pairs can be made)
  if not isinstance(_lowerCamelCase		,				_lowerCamelCase ):
    lowerCamelCase_         =						F'''Plugboard setting isn\'t type string ({type(_lowerCamelCase )})'''
    raise TypeError(_lowerCamelCase )
  elif len(_lowerCamelCase ) % 2 != 0:
    lowerCamelCase_         =						F'''Odd number of symbols ({len(_lowerCamelCase )})'''
    raise Exception(_lowerCamelCase )
  elif pbstring == "":
    return {}

  pbstring.replace(' '		,				'' )

  # Checks if all characters are unique
  lowerCamelCase_         =						set()
  for i in pbstring:
    if i not in abc:
      lowerCamelCase_         =						F'''\'{i}\' not in list of symbols'''
      raise Exception(_lowerCamelCase )
    elif i in tmppbl:
      lowerCamelCase_         =						F'''Duplicate symbol ({i})'''
      raise Exception(_lowerCamelCase )
    else:
      tmppbl.add(_lowerCamelCase )
  del tmppbl

  # Created the dictionary
  lowerCamelCase_         =						{}
  for j in range(0		,				len(_lowerCamelCase ) - 1		,				2 ):
    lowerCamelCase_         =						pbstring[j + 1]
    lowerCamelCase_         =						pbstring[j]

  return pb







def      lowerCamelCase__       (							_lowerCamelCase       :		str		,				_lowerCamelCase       :		RotorPositionT		,				_lowerCamelCase       :		RotorSelectionT = (rotora, rotora, rotora)		,				_lowerCamelCase       :		str = ""		,				)      ->				str:
  lowerCamelCase_         =						text.upper()
  lowerCamelCase_     ,	lowerCamelCase_     ,	lowerCamelCase_         =						_validator(
      _lowerCamelCase		,				_lowerCamelCase		,				plugb.upper() )

  lowerCamelCase_     ,	lowerCamelCase_     ,	lowerCamelCase_         =						rotor_position
  lowerCamelCase_     ,	lowerCamelCase_     ,	lowerCamelCase_         =						rotor_selection
  rotorposa -= 1
  rotorposa -= 1
  rotorposa -= 1

  lowerCamelCase_         =						[]

  # encryption/decryption process --------------------------
  for symbol in text:
    if symbol in abc:
      # 1st plugboard --------------------------
      if symbol in plugboard:
        lowerCamelCase_         =						plugboard[symbol]

      # rotor ra --------------------------
      lowerCamelCase_         =						abc.index(_lowerCamelCase ) + rotorposa
      lowerCamelCase_         =						rotora[index % len(_lowerCamelCase )]

      # rotor rb --------------------------
      lowerCamelCase_         =						abc.index(_lowerCamelCase ) + rotorposa
      lowerCamelCase_         =						rotora[index % len(_lowerCamelCase )]

      # rotor rc --------------------------
      lowerCamelCase_         =						abc.index(_lowerCamelCase ) + rotorposa
      lowerCamelCase_         =						rotora[index % len(_lowerCamelCase )]

      # reflector --------------------------
      # this is the reason you don't need another machine to decipher

      lowerCamelCase_         =						reflector[symbol]

      # 2nd rotors
      lowerCamelCase_         =						abc[rotora.index(_lowerCamelCase ) - rotorposa]
      lowerCamelCase_         =						abc[rotora.index(_lowerCamelCase ) - rotorposa]
      lowerCamelCase_         =						abc[rotora.index(_lowerCamelCase ) - rotorposa]

      # 2nd plugboard
      if symbol in plugboard:
        lowerCamelCase_         =						plugboard[symbol]

      # moves/resets rotor positions
      rotorposa += 1
      if rotorposa >= len(_lowerCamelCase ):
        lowerCamelCase_         =						0
        rotorposa += 1
      if rotorposa >= len(_lowerCamelCase ):
        lowerCamelCase_         =						0
        rotorposa += 1
      if rotorposa >= len(_lowerCamelCase ):
        lowerCamelCase_         =						0

        # else:
        #    pass
        #    Error could be also raised
        #    raise ValueError(
        #       'Invalid symbol('+repr(symbol)+')')
    result.append(_lowerCamelCase )

  return "".join(_lowerCamelCase )


if __name__ == "__main__":
  _SCREAMING_SNAKE_CASE					:				Any					    =						'''This is my Python script that emulates the Enigma machine from WWII.'''
  _SCREAMING_SNAKE_CASE					:				List[Any]					    =						(1, 1, 1)
  _SCREAMING_SNAKE_CASE					:				Union[str, Any]					    =						'''pictures'''
  _SCREAMING_SNAKE_CASE					:				Union[str, Any]					    =						(rotora, rotora, rotora)
  _SCREAMING_SNAKE_CASE					:				Tuple					    =						enigma(message, rotor_pos, rotor_sel, pb)

  print('''Encrypted message:''', en)
  print('''Decrypted message:''', enigma(en, rotor_pos, rotor_sel, pb))












"""simple docstring"""





from __future__ import annotations

import math







def      lowerCamelCase__       (							_lowerCamelCase       :		int )      ->				bool:

  if 1 < number < 4:
    # 2 and 3 are primes
    return True
  elif number < 2 or number % 2 == 0 or number % 3 == 0:
    # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
    return False

  # All primes number are in format of 6k +/- 1
  for i in range(5		,				int(math.sqrt(_lowerCamelCase ) + 1 )		,				6 ):
    if number % i == 0 or number % (i + 2) == 0:
      return False
  return True







def      lowerCamelCase__       (							_lowerCamelCase       :		int )      ->				list[int]:
  lowerCamelCase_         =						str(_lowerCamelCase )
  lowerCamelCase_         =						[n]
  for i in range(1		,				len(_lowerCamelCase ) ):
    list_nums.append(int(str_num[i:] ) )
    list_nums.append(int(str_num[:-i] ) )
  return list_nums







def      lowerCamelCase__       (							_lowerCamelCase       :		int )      ->				bool:
  if len(str(_lowerCamelCase ) ) > 3:
    if not is_prime(int(str(_lowerCamelCase )[-3:] ) ) or not is_prime(int(str(_lowerCamelCase )[:3] ) ):
      return False
  return True







def      lowerCamelCase__       (							_lowerCamelCase       :		int = 11 )      ->				list[int]:
  lowerCamelCase_         =						[]
  lowerCamelCase_         =						13
  while len(_lowerCamelCase ) != count:
    if validate(_lowerCamelCase ):
      lowerCamelCase_         =						list_truncated_nums(_lowerCamelCase )
      if all(is_prime(_lowerCamelCase ) for i in list_nums ):
        list_truncated_primes.append(_lowerCamelCase )
    num += 2
  return list_truncated_primes







def      lowerCamelCase__       (							)      ->				int:
  return sum(compute_truncated_primes(11 ) )


if __name__ == "__main__":
  print(F'''{sum(compute_truncated_primes(11)) = }''')




