




import itertools
from dataclasses import dataclass
from typing import List, Optional

import pyarrow as pa
import pyarrow.parquet as pq

import datasets
from datasets.table import table_cast


__a          =			datasets.utils.logging.get_logger(__name__)

@dataclass
class   __a(					datasets.BuilderConfig       ):






    """simple docstring"""





    lowerCAmelCase        =				1_0000
    lowerCAmelCase        =				None
    lowerCAmelCase        =				None


class   __a(					datasets.ArrowBasedBuilder       ):






    """simple docstring"""





    lowerCAmelCase        =				ParquetConfig





    def 							a__				(				self  )			->		Union[str, Any]:
         return datasets.DatasetInfo(features=self.config.features  )





    def 							a__				(				self       ,_SCREAMING_SNAKE_CASE  )			->		Optional[int]:
         if not self.config.data_files:
              raise ValueError(f'''At least one data file must be specified, but got data_files={self.config.data_files}'''  )
         UpperCAmelCase_      :							List[Any]       =      dl_manager.download_and_extract(self.config.data_files  )
         if isinstance(_SCREAMING_SNAKE_CASE       ,(str, list, tuple)  ):
              UpperCAmelCase_      :							List[str]       =      data_files
              if isinstance(_SCREAMING_SNAKE_CASE       ,_SCREAMING_SNAKE_CASE  ):
                   UpperCAmelCase_      :							Optional[Any]       =      [files]
              # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
              UpperCAmelCase_      :							Dict       =      [dl_manager.iter_files(_SCREAMING_SNAKE_CASE  ) for file in files]
              return [datasets.SplitGenerator(name=datasets.Split.TRAIN       ,gen_kwargs={'''files''': files}  )]
         UpperCAmelCase_      :							Optional[Any]       =      []
         for split_name, files in data_files.items():
              if isinstance(_SCREAMING_SNAKE_CASE       ,_SCREAMING_SNAKE_CASE  ):
                   UpperCAmelCase_      :							Any       =      [files]
              # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
              UpperCAmelCase_      :							List[str]       =      [dl_manager.iter_files(_SCREAMING_SNAKE_CASE  ) for file in files]
              # Infer features is they are stoed in the arrow schema
              if self.info.features is None:
                   for file in itertools.chain.from_iterable(_SCREAMING_SNAKE_CASE  ):
                        with open(_SCREAMING_SNAKE_CASE       ,'''rb'''  ) as f:
                             UpperCAmelCase_      :							Any       =      datasets.Features.from_arrow_schema(pq.read_schema(_SCREAMING_SNAKE_CASE  )  )
                        break
              splits.append(datasets.SplitGenerator(name=_SCREAMING_SNAKE_CASE       ,gen_kwargs={'''files''': files}  )  )
         return splits





    def 							a__				(				self       ,_SCREAMING_SNAKE_CASE  )			->		pa.Table:
         if self.info.features is not None:
              # more expensive cast to support nested features with keys in a different order
              # allows str <-> int/float or str to Audio for example
              UpperCAmelCase_      :							int       =      table_cast(_SCREAMING_SNAKE_CASE       ,self.info.features.arrow_schema  )
         return pa_table





    def 							a__				(				self       ,_SCREAMING_SNAKE_CASE  )			->		Optional[int]:
         UpperCAmelCase_      :							List[Any]       =      self.info.features.arrow_schema if self.info.features is not None else None
         if self.info.features is not None and self.config.columns is not None:
              if sorted(field.name for field in schema  ) != sorted(self.config.columns  ):
                   raise ValueError(
                       f'''Tried to load parquet data with columns \'{self.config.columns}\' with mismatching features \'{self.info.features}\''''  )
         for file_idx, file in enumerate(itertools.chain.from_iterable(_SCREAMING_SNAKE_CASE  )  ):
              with open(_SCREAMING_SNAKE_CASE       ,'''rb'''  ) as f:
                   UpperCAmelCase_      :							int       =      pq.ParquetFile(_SCREAMING_SNAKE_CASE  )
                   try:
                        for batch_idx, record_batch in enumerate(
                            parquet_file.iter_batches(batch_size=self.config.batch_size       ,columns=self.config.columns  )  ):
                             UpperCAmelCase_      :							str       =      pa.Table.from_batches([record_batch]  )
                             # Uncomment for debugging (will print the Arrow table size and elements)
                             # logger.warning(f"pa_table: {pa_table} num rows: {pa_table.num_rows}")
                             # logger.warning('\n'.join(str(pa_table.slice(i, 1).to_pydict()) for i in range(pa_table.num_rows)))
                             yield f'''{file_idx}_{batch_idx}''', self._cast_table(_SCREAMING_SNAKE_CASE  )
                   except ValueError as e:
                        logger.error(f'''Failed to read file \'{file}\' with error {type(_SCREAMING_SNAKE_CASE  )}: {e}'''  )
                        raise





from collections import defaultdict







def lowerCamelCase__       (      _lowercase			,						_lowercase				):

     '''simple docstring'''


     UpperCAmelCase_      :							Optional[int]       =      first_str.lower().strip()
     UpperCAmelCase_      :							Any       =      second_str.lower().strip()

     # Remove whitespace
     UpperCAmelCase_      :							Any       =      first_str.replace(''' '''			,						''''''				)
     UpperCAmelCase_      :							int       =      second_str.replace(''' '''			,						''''''				)

     # Strings of different lengths are not anagrams
     if len(_lowercase				) != len(_lowercase				):
          return False

     # Default values for count should be 0
     UpperCAmelCase_      :							defaultdict[str, int]       =      defaultdict(_lowercase				)

     # For each character in input strings,
     # increment count in the corresponding
     for i in range(len(_lowercase				)				):
          count[first_str[i]] += 1
          count[second_str[i]] -= 1

     return all(_count == 0 for _count in count.values()				)


if __name__ == "__main__":
     from doctest import testmod

     testmod()
     __a          =			input('Enter the first string ').strip()
     __a          =			input('Enter the second string ').strip()

     __a          =			check_anagrams(input_a, input_b)
     print(F"""{input_a} and {input_b} are {"" if status else "not "}anagrams.""")