(word)
| 49 | """ |
| 50 | |
| 51 | def translate_pattern(word): |
| 52 | result = ['0'] |
| 53 | current = '0' |
| 54 | patterns = {word[0]: '0'} |
| 55 | for i in word[1:]: |
| 56 | if patterns.get(i) is not None: |
| 57 | result.append(patterns.get(i)) |
| 58 | else: |
| 59 | current = str(int(current)+1) |
| 60 | patterns[i] = current |
| 61 | result.append(current) |
| 62 | |
| 63 | return ''.join(result) |
| 64 | |
| 65 | x = translate_pattern(pattern) |
| 66 |