message stringlengths 2 11.9k | message_type stringclasses 2 values | message_id int64 0 1 | conversation_id int64 137 108k | cluster float64 18 18 | __index_level_0__ int64 274 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a string S consisting of the uppercase English letters `P` and `D`, let the doctoral and postdoctoral quotient of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S = `PPDDP`, it contains two occurrences of `D` and one occurrence of `PD` as contiguous substrings, so the doctoral and postdoctoral quotient of S is 3.
We have a string T consisting of `P`, `D`, and `?`.
Among the strings that can be obtained by replacing each `?` in T with `P` or `D`, find one with the maximum possible doctoral and postdoctoral quotient.
Constraints
* 1 \leq |T| \leq 2 \times 10^5
* T consists of `P`, `D`, and `?`.
Input
Input is given from Standard Input in the following format:
T
Output
Print one string with the maximum possible doctoral and postdoctoral quotient among the strings that can be obtained by replacing each `?` in T with `P` or `D`. If there are multiple such strings, you may print any of them.
Examples
Input
PD?D??P
Output
PDPDPDP
Input
P?P?
Output
PDPD
Submitted Solution:
```
t = input()
tmp = t.replace('?', 'D')
print(tmp)
``` | instruction | 0 | 108,419 | 18 | 216,838 |
Yes | output | 1 | 108,419 | 18 | 216,839 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a string S consisting of the uppercase English letters `P` and `D`, let the doctoral and postdoctoral quotient of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S = `PPDDP`, it contains two occurrences of `D` and one occurrence of `PD` as contiguous substrings, so the doctoral and postdoctoral quotient of S is 3.
We have a string T consisting of `P`, `D`, and `?`.
Among the strings that can be obtained by replacing each `?` in T with `P` or `D`, find one with the maximum possible doctoral and postdoctoral quotient.
Constraints
* 1 \leq |T| \leq 2 \times 10^5
* T consists of `P`, `D`, and `?`.
Input
Input is given from Standard Input in the following format:
T
Output
Print one string with the maximum possible doctoral and postdoctoral quotient among the strings that can be obtained by replacing each `?` in T with `P` or `D`. If there are multiple such strings, you may print any of them.
Examples
Input
PD?D??P
Output
PDPDPDP
Input
P?P?
Output
PDPD
Submitted Solution:
```
T=input()
tmp=T.replace('?','D')
print(tmp)
``` | instruction | 0 | 108,422 | 18 | 216,844 |
Yes | output | 1 | 108,422 | 18 | 216,845 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a string S consisting of the uppercase English letters `P` and `D`, let the doctoral and postdoctoral quotient of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S = `PPDDP`, it contains two occurrences of `D` and one occurrence of `PD` as contiguous substrings, so the doctoral and postdoctoral quotient of S is 3.
We have a string T consisting of `P`, `D`, and `?`.
Among the strings that can be obtained by replacing each `?` in T with `P` or `D`, find one with the maximum possible doctoral and postdoctoral quotient.
Constraints
* 1 \leq |T| \leq 2 \times 10^5
* T consists of `P`, `D`, and `?`.
Input
Input is given from Standard Input in the following format:
T
Output
Print one string with the maximum possible doctoral and postdoctoral quotient among the strings that can be obtained by replacing each `?` in T with `P` or `D`. If there are multiple such strings, you may print any of them.
Examples
Input
PD?D??P
Output
PDPDPDP
Input
P?P?
Output
PDPD
Submitted Solution:
```
word = input()
start = 0
end = len(word)
while(True):
i = word.find('?', start, end)
if (i == -1):
break
elif ((i == (end-1)) or (word[i-1] == 'P')):
word.replace('?', "D", 1)
elif ((word[i+1] == "?") or (word[i+1] == "D")):
word.replace('?', "P", 1)
start = i + 1
print(word)
``` | instruction | 0 | 108,423 | 18 | 216,846 |
No | output | 1 | 108,423 | 18 | 216,847 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a string S consisting of the uppercase English letters `P` and `D`, let the doctoral and postdoctoral quotient of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S = `PPDDP`, it contains two occurrences of `D` and one occurrence of `PD` as contiguous substrings, so the doctoral and postdoctoral quotient of S is 3.
We have a string T consisting of `P`, `D`, and `?`.
Among the strings that can be obtained by replacing each `?` in T with `P` or `D`, find one with the maximum possible doctoral and postdoctoral quotient.
Constraints
* 1 \leq |T| \leq 2 \times 10^5
* T consists of `P`, `D`, and `?`.
Input
Input is given from Standard Input in the following format:
T
Output
Print one string with the maximum possible doctoral and postdoctoral quotient among the strings that can be obtained by replacing each `?` in T with `P` or `D`. If there are multiple such strings, you may print any of them.
Examples
Input
PD?D??P
Output
PDPDPDP
Input
P?P?
Output
PDPD
Submitted Solution:
```
if __name__ == "__main__":
t = input()
result = ""
pre_c = ""
for curr_c in t:
curr_c = "D" if pre_c == "P" else "P"
result += curr_c
pre_c = curr_c
print(result)
``` | instruction | 0 | 108,424 | 18 | 216,848 |
No | output | 1 | 108,424 | 18 | 216,849 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a string S consisting of the uppercase English letters `P` and `D`, let the doctoral and postdoctoral quotient of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S = `PPDDP`, it contains two occurrences of `D` and one occurrence of `PD` as contiguous substrings, so the doctoral and postdoctoral quotient of S is 3.
We have a string T consisting of `P`, `D`, and `?`.
Among the strings that can be obtained by replacing each `?` in T with `P` or `D`, find one with the maximum possible doctoral and postdoctoral quotient.
Constraints
* 1 \leq |T| \leq 2 \times 10^5
* T consists of `P`, `D`, and `?`.
Input
Input is given from Standard Input in the following format:
T
Output
Print one string with the maximum possible doctoral and postdoctoral quotient among the strings that can be obtained by replacing each `?` in T with `P` or `D`. If there are multiple such strings, you may print any of them.
Examples
Input
PD?D??P
Output
PDPDPDP
Input
P?P?
Output
PDPD
Submitted Solution:
```
# coding: utf-8
# Your code here!
s = list(input())
#print(s)
for i,j in enumerate(s):
if j == "?":
if (s[i - 1] == "P") or (s[i + 1] == "P"):
s[i] = "D"
for k in s:
print(k,end="")
``` | instruction | 0 | 108,425 | 18 | 216,850 |
No | output | 1 | 108,425 | 18 | 216,851 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.