'''simple docstring'''




import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs


if is_torch_available():
						import torch

if is_vision_available():
						from PIL import Image

						from transformers import VivitImageProcessor





class     __magic_name__						(    unittest.TestCase):







			def __init__(	self				:  Optional[Any]				,			lowercase_				:  Optional[Any]				,			lowercase_				:  str=7				,			lowercase_				:  Tuple=3				,			lowercase_				:  str=10				,			lowercase_				:  Any=18				,			lowercase_				:  List[Any]=30				,			lowercase_				:  Tuple=400				,			lowercase_				:  int=True				,			lowercase_				:  Union[str, Any]=None				,			lowercase_				:  Optional[int]=True				,			lowercase_				:  int=[0.5, 0.5, 0.5]				,			lowercase_				:  Optional[Any]=[0.5, 0.5, 0.5]				,			lowercase_				:  Any=None				,			):
										lowercase_					:			int										=       size if size is not None else {"""shortest_edge""": 18}
										lowercase_					:			Optional[int]										=       crop_size if crop_size is not None else {"""height""": 18, """width""": 18}

										lowercase_					:			str										=       parent
										lowercase_					:			Union[str, Any]										=       batch_size
										lowercase_					:			Optional[Any]										=       num_channels
										lowercase_					:			Dict										=       num_frames
										lowercase_					:			Optional[int]										=       image_size
										lowercase_					:			Any										=       min_resolution
										lowercase_					:			Dict										=       max_resolution
										lowercase_					:			Union[str, Any]										=       do_resize
										lowercase_					:			Tuple										=       size
										lowercase_					:			Optional[int]										=       do_normalize
										lowercase_					:			Any										=       image_mean
										lowercase_					:			List[Any]										=       image_std
										lowercase_					:			Optional[int]										=       crop_size







			def 	SCREAMING_SNAKE_CASE_     (	self				:  Union[str, Any]    ):
										return {
										    "image_mean": self.image_mean,
										    "image_std": self.image_std,
										    "do_normalize": self.do_normalize,
										    "do_resize": self.do_resize,
										    "size": self.size,
										    "crop_size": self.crop_size,
										}





@require_torch
@require_vision
class     __magic_name__						(    _UpperCAmelCase,     unittest.TestCase):
			UpperCamelCase__				=       VivitImageProcessor if is_vision_available() else None







			def 	SCREAMING_SNAKE_CASE_     (	self				:  Union[str, Any]    ):
										lowercase_					:			List[str]										=       VivitImageProcessingTester(self    )







			@property
			def 	SCREAMING_SNAKE_CASE_     (	self				:  List[str]    ):
										return self.image_processor_tester.prepare_image_processor_dict()







			def 	SCREAMING_SNAKE_CASE_     (	self				:  str    ):
										lowercase_					:			Union[str, Any]										=       self.image_processing_class(**self.image_processor_dict    )
										self.assertTrue(hasattr(lowercase_				,			"""image_mean"""    )    )
										self.assertTrue(hasattr(lowercase_				,			"""image_std"""    )    )
										self.assertTrue(hasattr(lowercase_				,			"""do_normalize"""    )    )
										self.assertTrue(hasattr(lowercase_				,			"""do_resize"""    )    )
										self.assertTrue(hasattr(lowercase_				,			"""do_center_crop"""    )    )
										self.assertTrue(hasattr(lowercase_				,			"""size"""    )    )







			def 	SCREAMING_SNAKE_CASE_     (	self				:  List[Any]    ):
										lowercase_					:			Dict										=       self.image_processing_class.from_dict(self.image_processor_dict    )
										self.assertEqual(image_processor.size				,			{"""shortest_edge""": 18}    )
										self.assertEqual(image_processor.crop_size				,			{"""height""": 18, """width""": 18}    )

										lowercase_					:			Any										=       self.image_processing_class.from_dict(self.image_processor_dict				,			size=42				,			crop_size=84    )
										self.assertEqual(image_processor.size				,			{"""shortest_edge""": 42}    )
										self.assertEqual(image_processor.crop_size				,			{"""height""": 84, """width""": 84}    )







			def 	SCREAMING_SNAKE_CASE_     (	self				:  int    ):
										# Initialize image_processing
										lowercase_					:			Optional[int]										=       self.image_processing_class(**self.image_processor_dict    )
										# create random PIL videos
										lowercase_					:			Optional[Any]										=       prepare_video_inputs(self.image_processor_tester				,			equal_resolution=lowercase_    )
										for video in video_inputs:
																	self.assertIsInstance(lowercase_				,			lowercase_    )
																	self.assertIsInstance(video[0]				,			Image.Image    )

										# Test not batched input
										lowercase_					:			Tuple										=       image_processing(video_inputs[0]				,			return_tensors="""pt"""    ).pixel_values
										self.assertEqual(
										    encoded_videos.shape				,			(
										        1,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size["""height"""],
										        self.image_processor_tester.crop_size["""width"""],
										    )				,			)

										# Test batched
										lowercase_					:			Dict										=       image_processing(lowercase_				,			return_tensors="""pt"""    ).pixel_values
										self.assertEqual(
										    encoded_videos.shape				,			(
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size["""height"""],
										        self.image_processor_tester.crop_size["""width"""],
										    )				,			)







			def 	SCREAMING_SNAKE_CASE_     (	self				:  Union[str, Any]    ):
										# Initialize image_processing
										lowercase_					:			Optional[int]										=       self.image_processing_class(**self.image_processor_dict    )
										# create random numpy tensors
										lowercase_					:			Dict										=       prepare_video_inputs(self.image_processor_tester				,			equal_resolution=lowercase_				,			numpify=lowercase_    )
										for video in video_inputs:
																	self.assertIsInstance(lowercase_				,			lowercase_    )
																	self.assertIsInstance(video[0]				,			np.ndarray    )

										# Test not batched input
										lowercase_					:			List[str]										=       image_processing(video_inputs[0]				,			return_tensors="""pt"""    ).pixel_values
										self.assertEqual(
										    encoded_videos.shape				,			(
										        1,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size["""height"""],
										        self.image_processor_tester.crop_size["""width"""],
										    )				,			)

										# Test batched
										lowercase_					:			int										=       image_processing(lowercase_				,			return_tensors="""pt"""    ).pixel_values
										self.assertEqual(
										    encoded_videos.shape				,			(
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size["""height"""],
										        self.image_processor_tester.crop_size["""width"""],
										    )				,			)







			def 	SCREAMING_SNAKE_CASE_     (	self				:  Optional[int]    ):
										# Initialize image_processing
										lowercase_					:			int										=       self.image_processing_class(**self.image_processor_dict    )
										# create random PyTorch tensors
										lowercase_					:			Dict										=       prepare_video_inputs(self.image_processor_tester				,			equal_resolution=lowercase_				,			torchify=lowercase_    )
										for video in video_inputs:
																	self.assertIsInstance(lowercase_				,			lowercase_    )
																	self.assertIsInstance(video[0]				,			torch.Tensor    )

										# Test not batched input
										lowercase_					:			Dict										=       image_processing(video_inputs[0]				,			return_tensors="""pt"""    ).pixel_values
										self.assertEqual(
										    encoded_videos.shape				,			(
										        1,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size["""height"""],
										        self.image_processor_tester.crop_size["""width"""],
										    )				,			)

										# Test batched
										lowercase_					:			int										=       image_processing(lowercase_				,			return_tensors="""pt"""    ).pixel_values
										self.assertEqual(
										    encoded_videos.shape				,			(
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size["""height"""],
										        self.image_processor_tester.crop_size["""width"""],
										    )				,			)






'''simple docstring'''




from collections import defaultdict




def 							lowerCamelCase	(      UpperCAmelCase__       :					str      ,      UpperCAmelCase__       :					str )			->      bool:
							lowercase_					:			Tuple										=       first_str.lower().strip()
							lowercase_					:			List[Any]										=       second_str.lower().strip()

							# Remove whitespace
							lowercase_					:			Dict										=       first_str.replace(""" """      ,      """""" )
							lowercase_					:			Tuple										=       second_str.replace(""" """      ,      """""" )

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

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

							# For each character in input strings,
							# increment count in the corresponding
							for i in range(len(UpperCAmelCase__ ) ):
														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()
						_lowercase						: int						=						input("Enter the first string ").strip()
						_lowercase						: Tuple						=						input("Enter the second string ").strip()

						_lowercase						: Union[str, Any]						=						check_anagrams(input_a, input_b)
						print(f"""{input_a} and {input_b} are {"" if status else "not "}anagrams.""")





