benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 0896e075-3952-568b-afcb-957a998bd955

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

from collections import defaultdict
import re

def task_func(word: str) -> dict:
    """
    Find the occurrences of each two-letter combination in the sanitized word,
    where only alphabetic characters are considered.

    Requirements:
    - collections.defaultdict
    - re
    
    Parameters:
    word (str): The input string.

    Returns:
    collections.defaultdict: A dictionary with keys as two-letter combinations and values as their counts in the sanitized word.

    Example:
    >>> task_func('abcdef')
    defaultdict(<class 'int'>, {'ab': 1, 'bc': 1, 'cd': 1, 'de': 1, 'ef': 1})
    >>> task_func('aabbcc')
    defaultdict(<class 'int'>, {'aa': 1, 'ab': 1, 'bb': 1, 'bc': 1, 'cc': 1})
    >>> task_func('a1!b@c#d$')
    defaultdict(<class 'int'>, {'ab': 1, 'bc': 1, 'cd': 1})
    """

instruct prompt

Find the occurrences of each two-letter combination in the sanitized word, where only alphabetic characters are considered.
The function should output with:
    collections.defaultdict: A dictionary with keys as two-letter combinations and values as their counts in the sanitized word.
You should write self-contained code starting with:

Code

from collections import defaultdict
import re
def task_func(word: str) -> dict:

code prompt

Code

from collections import defaultdict
import re
def task_func(word: str) -> dict:

entry point

task_func

libs

  • collections
  • re

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import