<jupyter_start><jupyter_text>2020년 8월 4일 화요일 leetCode - Word Pattern (Python) 문제 : https://leetcode.com/problems/word-pattern/ 블로그 : https://somjang.tistory.com/entry/leetCode-290-Word-Pattern-Python  첫번째 시도<jupyter_code>class Solution:
    def wordPattern(self, pattern: str, string: str) -> bool:
        string_s = string.split(' ')
        
        answer = True
        
        check_dict = {}
        
        for p, s in zip(pattern, string_s):
            if p not in check_dict.keys():
                check_dict[p] = s
            else:
                if check_dict[p] != s:
                    answer = False
                    break
        if (len(set(check_dict.keys())) != len(set(check_dict.values()))) or (len(pattern) != len(string_s)):
            answer = False
        return answer<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12081339712918661, 'fraction_numerical': 0.01076555023923445, 'mean_word_length': 1.9575971731448762, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '495816', 'license': 'MIT', 'n_tokens_mistral': 285, 'n_tokens_neox': 286, 'n_words': 57, 'path': 'DAY 101 ~ 200/DAY180_[leetCode] Word Pattern (Python).ipynb', 'repo_name': 'SOMJANG/CODINGTEST_PRACTICE', 'size': '836'}