Mbpp/165

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度454 字符
模型生成的代码 (454 字符)
def count_char_position(s: str) -> int:
    """
    Count the number of characters in a string that occur at the same position
    in the string as in the English alphabet (case insensitive).
    """
    count = 0
    for i, ch in enumerate(s):
        # Position in the alphabet (1-based)
        alpha_pos = ord(ch.lower()) - ord('a') + 1
        # Position in the string (1-based)
        if alpha_pos == i + 1:
            count += 1
    return count
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试