ID
s5oeuzlb6ij36miihdoy4mnj34
Status
Succeeded
Source
Web
Hardware
A40 (Large)
Total duration
Created
Webhook

Input

prompt
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Write a short program that counts the number of occurrences of a character in a string. ### Response:
grammar
root ::= "```python\ndef num_occurrences(c: str, s: str) -> int:\n " code "```" code ::= [^`()]+
max_tokens
500
temperature
0.8
top_p
0.95
top_k
10
frequency_penalty
0
presence_penalty
0
repeat_penalty
1.1
mirostat_mode
Disabled
mirostat_learning_rate
0.1
mirostat_entropy
5

Output

```python
def num_occurrences(c: str, s: str) -> int:
    """Counts the number of occurrences of a character c in a string s."""
    count = 0
    for char in s:
        if char == c:
            count += 1
    return count
```
Generated in