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.
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.
The valid sizes of T-shirts are either "M" or from 0 to 3 "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are not.
There are n winners to the cup for both the previous year and the current year. Ksenia has a list with the T-shirt sizes printed for the last year cup and is yet to send the new list to the printing office.
Organizers want to distribute the prizes as soon as possible, so now Ksenia is required not to write the whole list from the scratch but just make some changes to the list of the previous year. In one second she can choose arbitrary position in any word and replace its character with some uppercase Latin letter. Ksenia can't remove or add letters in any of the words.
What is the minimal number of seconds Ksenia is required to spend to change the last year list to the current one?
The lists are unordered. That means, two lists are considered equal if and only if the number of occurrences of any string is the same in both lists.
Input
The first line contains one integer n (1 ≤ n ≤ 100) — the number of T-shirts.
The i-th of the next n lines contains a_i — the size of the i-th T-shirt of the list for the previous year.
The i-th of the next n lines contains b_i — the size of the i-th T-shirt of the list for the current year.
It is guaranteed that all the sizes in the input are valid. It is also guaranteed that Ksenia can produce list b from the list a.
Output
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
Examples
Input
3
XS
XS
M
XL
S
XS
Output
2
Input
2
XXXL
XXL
XXL
XXXS
Output
1
Input
2
M
XS
XS
M
Output
0
Note
In the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".
In the second example Ksenia should replace "L" in "XXXL" with "S".
In the third example lists are equal.
Submitted Solution:
```
n = int(input())
ls1 = list()
ls2 = list()
ls1div = list()
ls2div = list()
count = 0
for i in range(0,n):
ls1.append(input())
for i in range(0,n):
ls2.append(input())
for i in range(1,4):
ls1div.append([x[-1] for x in ls1 if len(x) == i])
ls2div.append([x[-1] for x in ls2 if len(x) == i])
count += abs(ls1div[i-1].count('S')-ls2div[i-1].count('S'))+abs(ls1div[i-1].count('M')-ls2div[i-1].count('M'))+abs(ls1div[i-1].count('L')-ls2div[i-1].count('L'))
print(int(count/2))
``` | instruction | 0 | 6,586 | 18 | 13,172 |
No | output | 1 | 6,586 | 18 | 13,173 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.
The valid sizes of T-shirts are either "M" or from 0 to 3 "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are not.
There are n winners to the cup for both the previous year and the current year. Ksenia has a list with the T-shirt sizes printed for the last year cup and is yet to send the new list to the printing office.
Organizers want to distribute the prizes as soon as possible, so now Ksenia is required not to write the whole list from the scratch but just make some changes to the list of the previous year. In one second she can choose arbitrary position in any word and replace its character with some uppercase Latin letter. Ksenia can't remove or add letters in any of the words.
What is the minimal number of seconds Ksenia is required to spend to change the last year list to the current one?
The lists are unordered. That means, two lists are considered equal if and only if the number of occurrences of any string is the same in both lists.
Input
The first line contains one integer n (1 ≤ n ≤ 100) — the number of T-shirts.
The i-th of the next n lines contains a_i — the size of the i-th T-shirt of the list for the previous year.
The i-th of the next n lines contains b_i — the size of the i-th T-shirt of the list for the current year.
It is guaranteed that all the sizes in the input are valid. It is also guaranteed that Ksenia can produce list b from the list a.
Output
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
Examples
Input
3
XS
XS
M
XL
S
XS
Output
2
Input
2
XXXL
XXL
XXL
XXXS
Output
1
Input
2
M
XS
XS
M
Output
0
Note
In the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".
In the second example Ksenia should replace "L" in "XXXL" with "S".
In the third example lists are equal.
Submitted Solution:
```
n = int(input())
old = []
new = []
out = False
for i in range(n):
old.append(input().strip())
if n == 100 and i == 0 and old[i] == 'S':
out = True
for i in range(n):
new.append(input().strip())
old = sorted(old)
new = sorted(new)
answer = 0
for i in range(n):
if old[i] != new[i]:
answer += 1
if out:
for i in range(0, 49):
print(old[i], end=' ')
print("END OF OUTPUT")
for i in range(50, 99):
print(old[i], end=' ')
print("END OF OUTPUT")
for i in range(0, 49):
print(new[i], end=' ')
print("END OF OUTPUT")
for i in range(50, 99):
print(new[i], end=' ')
print("END OF OUTPUT")
print(answer)
``` | instruction | 0 | 6,587 | 18 | 13,174 |
No | output | 1 | 6,587 | 18 | 13,175 |
Provide a correct Python 3 solution for this coding contest problem.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red | instruction | 0 | 7,318 | 18 | 14,636 |
"Correct Solution:
```
a=int(input())
b=input()
if a<3200:
print("red")
else:
print(b)
``` | output | 1 | 7,318 | 18 | 14,637 |
Provide a correct Python 3 solution for this coding contest problem.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red | instruction | 0 | 7,319 | 18 | 14,638 |
"Correct Solution:
```
f=input;print('red' if int(f())<3200 else f())
``` | output | 1 | 7,319 | 18 | 14,639 |
Provide a correct Python 3 solution for this coding contest problem.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red | instruction | 0 | 7,320 | 18 | 14,640 |
"Correct Solution:
```
A = int(input())
S = input()
ans = S if A >= 3200 else 'red'
print(ans)
``` | output | 1 | 7,320 | 18 | 14,641 |
Provide a correct Python 3 solution for this coding contest problem.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red | instruction | 0 | 7,321 | 18 | 14,642 |
"Correct Solution:
```
a = int(input())
s = input()
if a < 3200:
s = 'red'
print(s)
``` | output | 1 | 7,321 | 18 | 14,643 |
Provide a correct Python 3 solution for this coding contest problem.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red | instruction | 0 | 7,322 | 18 | 14,644 |
"Correct Solution:
```
a,s=open(0);print(s*(a>'32')or'red')
``` | output | 1 | 7,322 | 18 | 14,645 |
Provide a correct Python 3 solution for this coding contest problem.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red | instruction | 0 | 7,323 | 18 | 14,646 |
"Correct Solution:
```
a=int(input())
s=str(input())
if a<3200:
print('red')
else:
print(s)
``` | output | 1 | 7,323 | 18 | 14,647 |
Provide a correct Python 3 solution for this coding contest problem.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red | instruction | 0 | 7,324 | 18 | 14,648 |
"Correct Solution:
```
a = int(input())
s = input()
print("red" if a<3200 else s)
``` | output | 1 | 7,324 | 18 | 14,649 |
Provide a correct Python 3 solution for this coding contest problem.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red | instruction | 0 | 7,325 | 18 | 14,650 |
"Correct Solution:
```
a = int(input())
print("red" if a < 3200 else input())
``` | output | 1 | 7,325 | 18 | 14,651 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red
Submitted Solution:
```
n=int(input()); k=input(); print(k) if n>=3200 else print('red')
``` | instruction | 0 | 7,326 | 18 | 14,652 |
Yes | output | 1 | 7,326 | 18 | 14,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red
Submitted Solution:
```
n = int(input())
m = input()
print(m if n >= 3200 else "red")
``` | instruction | 0 | 7,327 | 18 | 14,654 |
Yes | output | 1 | 7,327 | 18 | 14,655 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red
Submitted Solution:
```
if (int(input()) < 3200):
print('red')
else:
print(input())
``` | instruction | 0 | 7,328 | 18 | 14,656 |
Yes | output | 1 | 7,328 | 18 | 14,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red
Submitted Solution:
```
a = int(input())
print(input() if a >= 3200 else "red")
``` | instruction | 0 | 7,329 | 18 | 14,658 |
Yes | output | 1 | 7,329 | 18 | 14,659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red
Submitted Solution:
```
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return map(fn, readline().split())
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
a = gete(int)
s = gete()
if s < 3200:
print(a)
else:
print('red')
if __name__ == "__main__":
main()
``` | instruction | 0 | 7,330 | 18 | 14,660 |
No | output | 1 | 7,330 | 18 | 14,661 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red
Submitted Solution:
```
import sys
a = input()[0]
s = input()[1]
if a < 3200:
print("red")
else:
print(s)
``` | instruction | 0 | 7,331 | 18 | 14,662 |
No | output | 1 | 7,331 | 18 | 14,663 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red
Submitted Solution:
```
if int(input) >= 3200:
print(input())
else:
print("red")
exit()
``` | instruction | 0 | 7,332 | 18 | 14,664 |
No | output | 1 | 7,332 | 18 | 14,665 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200.
Constraints
* 2800 \leq a < 5000
* s is a string of length between 1 and 10 (inclusive).
* Each character of s is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
a
s
Output
If a is not less than 3200, print s; if a is less than 3200, print `red`.
Examples
Input
3200
pink
Output
pink
Input
3199
pink
Output
red
Input
4049
red
Output
red
Submitted Solution:
```
data = [input() for i in range(2)]
if data[0]>=3200:
print(data[1])
else:
print("red")
``` | instruction | 0 | 7,333 | 18 | 14,666 |
No | output | 1 | 7,333 | 18 | 14,667 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You will receive 5 points for solving this problem.
Manao has invented a new operation on strings that is called folding. Each fold happens between a pair of consecutive letters and places the second part of the string above first part, running in the opposite direction and aligned to the position of the fold. Using this operation, Manao converts the string into a structure that has one more level than there were fold operations performed. See the following examples for clarity.
We will denote the positions of folds with '|' characters. For example, the word "ABRACADABRA" written as "AB|RACA|DAB|RA" indicates that it has been folded three times: first, between the leftmost pair of 'B' and 'R' letters; second, between 'A' and 'D'; and third, between the rightmost pair of 'B' and 'R' letters. Here are several examples of folded strings:
"ABCDEF|GHIJK" | "A|BCDEFGHIJK" | "AB|RACA|DAB|RA" | "X|XXXXX|X|X|XXXXXX"
| | | XXXXXX
KJIHG | KJIHGFEDCB | AR | X
ABCDEF | A | DAB | X
| | ACAR | XXXXX
| | AB | X
One last example for "ABCD|EFGH|IJ|K":
K
IJ
HGFE
ABCD
Manao noticed that each folded string can be viewed as several piles of letters. For instance, in the previous example, there are four piles, which can be read as "AHI", "BGJK", "CF", and "DE" from bottom to top. Manao wonders what is the highest pile of identical letters he can build using fold operations on a given word. Note that the pile should not contain gaps and should start at the bottom level. For example, in the rightmost of the four examples above, none of the piles would be considered valid since each of them has gaps, starts above the bottom level, or both.
Input
The input will consist of one line containing a single string of n characters with 1 ≤ n ≤ 1000 and no spaces. All characters of the string will be uppercase letters.
This problem doesn't have subproblems. You will get 5 points for the correct submission.
Output
Print a single integer — the size of the largest pile composed of identical characters that can be seen in a valid result of folding operations on the given string.
Examples
Input
ABRACADABRA
Output
3
Input
ABBBCBDB
Output
3
Input
AB
Output
1
Note
Consider the first example. Manao can create a pile of three 'A's using the folding "AB|RACAD|ABRA", which results in the following structure:
ABRA
DACAR
AB
In the second example, Manao can create a pile of three 'B's using the following folding: "AB|BB|CBDB".
CBDB
BB
AB
Another way for Manao to create a pile of three 'B's with "ABBBCBDB" is the following folding: "AB|B|BCBDB".
BCBDB
B
AB
In the third example, there are no folds performed and the string is just written in one line.
Submitted Solution:
```
a = str(input())
anss = []
for i in range(len(a)):
anss.append(a.count(a[i]))
print(max(anss)//2+1)
``` | instruction | 0 | 7,902 | 18 | 15,804 |
No | output | 1 | 7,902 | 18 | 15,805 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b are different. Then your task will be to find any string s3 of length n, such that f(s1, s3) = f(s2, s3) = t. If there is no such string, print - 1.
Input
The first line contains two integers n and t (1 ≤ n ≤ 105, 0 ≤ t ≤ n).
The second line contains string s1 of length n, consisting of lowercase English letters.
The third line contain string s2 of length n, consisting of lowercase English letters.
Output
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
Examples
Input
3 2
abc
xyc
Output
ayd
Input
1 0
c
b
Output
-1
Submitted Solution:
```
n, t = [int(x) for x in input().split()]
s1 = list(input())
s2 = list(input())
z1 = n - t
z2 = n - t
o = []
m = set([])
alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
for i, c in enumerate(s1):
m.add(c)
if z1 > 0:
o.append(c)
z1 -= 1
if c == s2[i]:
z2 -= 1
elif z2 > 0:
o.append(s2[i])
z2 -= 1
if c == s2[i]:
z1 -= 1
for oi, oc in enumerate(o):
if oc == s1[oi] and oc != s2[oi]:
r = ""
for a_i in range(0, len(alphabet)):
r = alphabet[a_i]
if r not in m:
break
o[oi] = r
z1 += 1
else:
r = ""
for a_i in range(0, len(alphabet)):
r = alphabet[a_i]
if r not in m:
break
o.append(r)
if len(list(m)) == len(alphabet) and t != 0:
print(-1)
elif z1 == 0 and z2 == 0:
print("".join(o))
else:
print(-1)
``` | instruction | 0 | 7,957 | 18 | 15,914 |
No | output | 1 | 7,957 | 18 | 15,915 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.
The distance between two letters is defined as the difference between their positions in the alphabet. For example, <image>, and <image>.
Also, the distance between two nice strings is defined as the sum of distances of corresponding letters. For example, <image>, and <image>.
Limak gives you a nice string s and an integer k. He challenges you to find any nice string s' that <image>. Find any s' satisfying the given conditions, or print "-1" if it's impossible to do so.
As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use gets/scanf/printf instead of getline/cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java.
Input
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106).
The second line contains a string s of length n, consisting of lowercase English letters.
Output
If there is no string satisfying the given conditions then print "-1" (without the quotes).
Otherwise, print any nice string s' that <image>.
Examples
Input
4 26
bear
Output
roar
Input
2 7
af
Output
db
Input
3 1000
hey
Output
-1
Submitted Solution:
```
N, K = map(int, input().split())
S = input()
dmax = [0 for _ in range(N)]
for i in range(N):
dmax[i] = max(abs(ord(S[i]) - 97), abs(25 - ord(S[i]) + 97))
dsum = sum(dmax)
if dsum < K:
print(-1)
else:
j = 0
for i in range(dsum + 1):
if dsum == K:
break
if dmax[j] == 0:
j += 1
dmax[j] -= 1
dsum -= 1
res = []
for i in range(N):
if ord(S[i]) - 97 + dmax[i] < 26:
res.append(chr(ord(S[i]) + dmax[i]))
else:
res.append(chr(ord(S[i]) - dmax[i]))
print(''.join(res))
``` | instruction | 0 | 7,985 | 18 | 15,970 |
Yes | output | 1 | 7,985 | 18 | 15,971 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.
The distance between two letters is defined as the difference between their positions in the alphabet. For example, <image>, and <image>.
Also, the distance between two nice strings is defined as the sum of distances of corresponding letters. For example, <image>, and <image>.
Limak gives you a nice string s and an integer k. He challenges you to find any nice string s' that <image>. Find any s' satisfying the given conditions, or print "-1" if it's impossible to do so.
As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use gets/scanf/printf instead of getline/cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java.
Input
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106).
The second line contains a string s of length n, consisting of lowercase English letters.
Output
If there is no string satisfying the given conditions then print "-1" (without the quotes).
Otherwise, print any nice string s' that <image>.
Examples
Input
4 26
bear
Output
roar
Input
2 7
af
Output
db
Input
3 1000
hey
Output
-1
Submitted Solution:
```
a,b=map(int,input().split())
str1=input()
str2=""
for i in range(0,a):
x=ord(str1[i])
x=x-97
if(x<=12):
z=min((25-x),(b))
zz=x+z+97
str3=chr(zz)
str2=str2[0:]+str3[0:]
b=b-z
else:
z=min((x-0),(b))
zz=x-z+97
str3=chr(zz)
str2=str2[0:]+str3[0:]
b=b-z
if(b>0):
print(-1)
else:
print(str2)
``` | instruction | 0 | 7,986 | 18 | 15,972 |
Yes | output | 1 | 7,986 | 18 | 15,973 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.
The distance between two letters is defined as the difference between their positions in the alphabet. For example, <image>, and <image>.
Also, the distance between two nice strings is defined as the sum of distances of corresponding letters. For example, <image>, and <image>.
Limak gives you a nice string s and an integer k. He challenges you to find any nice string s' that <image>. Find any s' satisfying the given conditions, or print "-1" if it's impossible to do so.
As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use gets/scanf/printf instead of getline/cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java.
Input
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106).
The second line contains a string s of length n, consisting of lowercase English letters.
Output
If there is no string satisfying the given conditions then print "-1" (without the quotes).
Otherwise, print any nice string s' that <image>.
Examples
Input
4 26
bear
Output
roar
Input
2 7
af
Output
db
Input
3 1000
hey
Output
-1
Submitted Solution:
```
if __name__ == '__main__':
# print(ord('a'), ord('m'), ord('n'), ord('z'))
# 97 109 110 122
n, k = input().split()
n = int(n)
k = int(k)
s = input()
ans = ''
hasAnswer = False
for i in range(n):
if k == 0:
hasAnswer = True
break
m = ord(s[i])
if m <= 109:
if k >= 122 - m:
k -= 122-m
ans += 'z'
else:
if m + k < 122:
ans += chr(m + k)
else:
ans += chr(m - k)
hasAnswer = True
break
if m >= 110:
if k >= m - 97:
k -= m - 97
ans += 'a'
else:
if m + k < 122:
ans += chr(m + k)
else:
ans += chr(m - k)
hasAnswer = True
break
if hasAnswer or k == 0:
print(ans + s[len(ans):])
else:
print(-1)
``` | instruction | 0 | 7,987 | 18 | 15,974 |
Yes | output | 1 | 7,987 | 18 | 15,975 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.
The distance between two letters is defined as the difference between their positions in the alphabet. For example, <image>, and <image>.
Also, the distance between two nice strings is defined as the sum of distances of corresponding letters. For example, <image>, and <image>.
Limak gives you a nice string s and an integer k. He challenges you to find any nice string s' that <image>. Find any s' satisfying the given conditions, or print "-1" if it's impossible to do so.
As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use gets/scanf/printf instead of getline/cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java.
Input
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106).
The second line contains a string s of length n, consisting of lowercase English letters.
Output
If there is no string satisfying the given conditions then print "-1" (without the quotes).
Otherwise, print any nice string s' that <image>.
Examples
Input
4 26
bear
Output
roar
Input
2 7
af
Output
db
Input
3 1000
hey
Output
-1
Submitted Solution:
```
n,k = map(int,input().split())
s = input()
alth = "abcdefghijklmnopqrstuvwxyz"
num2 = 0
s2 = ""
for i in s:
num2 = alth.find(i)
if k == 0:
s2 += i
else:
if num2 > 12:
num3 = min(num2,k)
s2 += alth[num2-num3]
k -= num3
else:
num3 = min(25-num2,k)
s2 += alth[num2+num3]
k -= num3
if k > 0:
print(-1)
else:
print(s2)
``` | instruction | 0 | 7,988 | 18 | 15,976 |
Yes | output | 1 | 7,988 | 18 | 15,977 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.
The distance between two letters is defined as the difference between their positions in the alphabet. For example, <image>, and <image>.
Also, the distance between two nice strings is defined as the sum of distances of corresponding letters. For example, <image>, and <image>.
Limak gives you a nice string s and an integer k. He challenges you to find any nice string s' that <image>. Find any s' satisfying the given conditions, or print "-1" if it's impossible to do so.
As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use gets/scanf/printf instead of getline/cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java.
Input
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106).
The second line contains a string s of length n, consisting of lowercase English letters.
Output
If there is no string satisfying the given conditions then print "-1" (without the quotes).
Otherwise, print any nice string s' that <image>.
Examples
Input
4 26
bear
Output
roar
Input
2 7
af
Output
db
Input
3 1000
hey
Output
-1
Submitted Solution:
```
letters = list('abcdefghijklmnopqrstuvwxyz')
def get_largest_distance(char):
if letters.index(char) > 13:
return 'a'
return 'z'
def get_fixed_distance(char, amount):
return letters[abs(letters.index(char) - amount)]
def dist(a, b):
return abs(letters.index(a) - letters.index(b))
line = input()
word_length, final_distance = line.split()
word_length, final_distance = int(word_length), int(final_distance)
word = input()
active_total = 0
built_string = ''
did_break = False
for charactor in word:
largest_distance_char = get_largest_distance(charactor)
current_dist = dist(charactor, largest_distance_char)
if active_total + current_dist > final_distance:
sub_distance = get_fixed_distance(charactor, final_distance - active_total)
active_total = active_total + dist(charactor, sub_distance)
built_string = built_string + sub_distance
did_break = True
break
else:
active_total = active_total + current_dist
built_string = built_string + largest_distance_char
if active_total < final_distance:
print(-1)
elif did_break == True:
for char in range(len(built_string), len(word)):
built_string = built_string + word[char]
print(built_string)
else:
print(built_string)
``` | instruction | 0 | 7,989 | 18 | 15,978 |
No | output | 1 | 7,989 | 18 | 15,979 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.
The distance between two letters is defined as the difference between their positions in the alphabet. For example, <image>, and <image>.
Also, the distance between two nice strings is defined as the sum of distances of corresponding letters. For example, <image>, and <image>.
Limak gives you a nice string s and an integer k. He challenges you to find any nice string s' that <image>. Find any s' satisfying the given conditions, or print "-1" if it's impossible to do so.
As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use gets/scanf/printf instead of getline/cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java.
Input
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106).
The second line contains a string s of length n, consisting of lowercase English letters.
Output
If there is no string satisfying the given conditions then print "-1" (without the quotes).
Otherwise, print any nice string s' that <image>.
Examples
Input
4 26
bear
Output
roar
Input
2 7
af
Output
db
Input
3 1000
hey
Output
-1
Submitted Solution:
```
n,k = map(int, input().split())
s = input()
p = []
ans = 0
s1 = ''
p1 = []
for i in range(len(s)):
p.append(ord(s[i]) - 96)
ans+=max(p[i],26 - p[i])
if ans < k:
print(-1)
else:
for i in range(len(s)):
if p[i] > 13:
if k >= p[i]:
s1+='a'
p1.append(1)
k-=p[i]
else:
p[i]-=k
k = 0
s1+=chr(p[i] + 96)
p1.append(p[i])
else:
if k >= 26 - p[i]:
s1+='z'
p1.append(26)
k-=26 - p[i]
else:
s1+=chr(p[i] + k + 96)
p1.append(p[i] + k)
k = 0
print(s1)
``` | instruction | 0 | 7,990 | 18 | 15,980 |
No | output | 1 | 7,990 | 18 | 15,981 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.
The distance between two letters is defined as the difference between their positions in the alphabet. For example, <image>, and <image>.
Also, the distance between two nice strings is defined as the sum of distances of corresponding letters. For example, <image>, and <image>.
Limak gives you a nice string s and an integer k. He challenges you to find any nice string s' that <image>. Find any s' satisfying the given conditions, or print "-1" if it's impossible to do so.
As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use gets/scanf/printf instead of getline/cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java.
Input
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106).
The second line contains a string s of length n, consisting of lowercase English letters.
Output
If there is no string satisfying the given conditions then print "-1" (without the quotes).
Otherwise, print any nice string s' that <image>.
Examples
Input
4 26
bear
Output
roar
Input
2 7
af
Output
db
Input
3 1000
hey
Output
-1
Submitted Solution:
```
import sys
n,k=map(int,sys.stdin.readline().split())
s=sys.stdin.readline()
ans=""
for i in s:
a=ord("z")-ord(i)
b=ord(i)-ord("a")
if k==0:
ans+=i
continue
if a>=b:
if a>=k:
ans+=chr(ord(i)+k)
k=0
else:
ans+="z"
k=k-a
else:
if b>=k:
ans+=chr(ord(i)-k)
k=0
else:
ans+="a"
k=k-b
if k==0:
print(ans)
else:
print(-1)
``` | instruction | 0 | 7,991 | 18 | 15,982 |
No | output | 1 | 7,991 | 18 | 15,983 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.
The distance between two letters is defined as the difference between their positions in the alphabet. For example, <image>, and <image>.
Also, the distance between two nice strings is defined as the sum of distances of corresponding letters. For example, <image>, and <image>.
Limak gives you a nice string s and an integer k. He challenges you to find any nice string s' that <image>. Find any s' satisfying the given conditions, or print "-1" if it's impossible to do so.
As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use gets/scanf/printf instead of getline/cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java.
Input
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106).
The second line contains a string s of length n, consisting of lowercase English letters.
Output
If there is no string satisfying the given conditions then print "-1" (without the quotes).
Otherwise, print any nice string s' that <image>.
Examples
Input
4 26
bear
Output
roar
Input
2 7
af
Output
db
Input
3 1000
hey
Output
-1
Submitted Solution:
```
alepha = ["a", "b", "c", "d",
"e", "f", "g", "h", "i",
"j", "k", "l", "m", "n",
"o", "p", "q", "r", "s", "t",
"u", "v", "w", "x", "y", "z"]
a, b = map(int, input().split())
s = input()
ans = ""
if b / a > 25:
print(-1)
else:
for i in range(a):
if b == 0:
ans += s[i]
continue
idx = alepha.index(s[i])
if idx > 13:
if b > 13:
ans += alepha[0]
b -= idx
else:
ans += alepha[idx - b]
b = 0
else:
if b > 13:
ans += alepha[25]
b -= 25 - idx
else:
ans += alepha[idx + b]
b = 0
if b==0:
print(ans)
else:
print(-1)
``` | instruction | 0 | 7,992 | 18 | 15,984 |
No | output | 1 | 7,992 | 18 | 15,985 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits and underline symbols («_»). However, in order to decrease the number of frauds and user-inattention related issues, it is prohibited to register a login if it is similar with an already existing login. More precisely, two logins s and t are considered similar if we can transform s to t via a sequence of operations of the following types:
* transform lowercase letters to uppercase and vice versa;
* change letter «O» (uppercase latin letter) to digit «0» and vice versa;
* change digit «1» (one) to any letter among «l» (lowercase latin «L»), «I» (uppercase latin «i») and vice versa, or change one of these letters to other.
For example, logins «Codeforces» and «codef0rces» as well as «OO0OOO00O0OOO0O00OOO0OO_lol» and «OO0OOO0O00OOO0O00OO0OOO_1oI» are considered similar whereas «Codeforces» and «Code_forces» are not.
You're given a list of existing logins with no two similar amonst and a newly created user login. Check whether this new login is similar with any of the existing ones.
Input
The first line contains a non-empty string s consisting of lower and uppercase latin letters, digits and underline symbols («_») with length not exceeding 50 — the login itself.
The second line contains a single integer n (1 ≤ n ≤ 1 000) — the number of existing logins.
The next n lines describe the existing logins, following the same constraints as the user login (refer to the first line of the input). It's guaranteed that no two existing logins are similar.
Output
Print «Yes» (without quotes), if user can register via this login, i.e. none of the existing logins is similar with it.
Otherwise print «No» (without quotes).
Examples
Input
1_wat
2
2_wat
wat_1
Output
Yes
Input
000
3
00
ooA
oOo
Output
No
Input
_i_
3
__i_
_1_
I
Output
No
Input
La0
3
2a0
La1
1a0
Output
No
Input
abc
1
aBc
Output
No
Input
0Lil
2
LIL0
0Ril
Output
Yes
Note
In the second sample case the user wants to create a login consisting of three zeros. It's impossible due to collision with the third among the existing.
In the third sample case the new login is similar with the second one.
Submitted Solution:
```
s = input()
n = int(input())
for i in range(n):
t = input()
if len(s) != len(t):
continue
for j in range(len(t)):
if t[j].lower() == s[j].lower():
continue
if t[j] in '0Oo' and s[j] in '0Oo':
continue
if s[j] in '1lILi' and t[j] in '1lILi':
continue
# print(s[j], t[j], s, t, i)
break
else:
print('No')
exit(0)
print('Yes')
``` | instruction | 0 | 8,128 | 18 | 16,256 |
Yes | output | 1 | 8,128 | 18 | 16,257 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits and underline symbols («_»). However, in order to decrease the number of frauds and user-inattention related issues, it is prohibited to register a login if it is similar with an already existing login. More precisely, two logins s and t are considered similar if we can transform s to t via a sequence of operations of the following types:
* transform lowercase letters to uppercase and vice versa;
* change letter «O» (uppercase latin letter) to digit «0» and vice versa;
* change digit «1» (one) to any letter among «l» (lowercase latin «L»), «I» (uppercase latin «i») and vice versa, or change one of these letters to other.
For example, logins «Codeforces» and «codef0rces» as well as «OO0OOO00O0OOO0O00OOO0OO_lol» and «OO0OOO0O00OOO0O00OO0OOO_1oI» are considered similar whereas «Codeforces» and «Code_forces» are not.
You're given a list of existing logins with no two similar amonst and a newly created user login. Check whether this new login is similar with any of the existing ones.
Input
The first line contains a non-empty string s consisting of lower and uppercase latin letters, digits and underline symbols («_») with length not exceeding 50 — the login itself.
The second line contains a single integer n (1 ≤ n ≤ 1 000) — the number of existing logins.
The next n lines describe the existing logins, following the same constraints as the user login (refer to the first line of the input). It's guaranteed that no two existing logins are similar.
Output
Print «Yes» (without quotes), if user can register via this login, i.e. none of the existing logins is similar with it.
Otherwise print «No» (without quotes).
Examples
Input
1_wat
2
2_wat
wat_1
Output
Yes
Input
000
3
00
ooA
oOo
Output
No
Input
_i_
3
__i_
_1_
I
Output
No
Input
La0
3
2a0
La1
1a0
Output
No
Input
abc
1
aBc
Output
No
Input
0Lil
2
LIL0
0Ril
Output
Yes
Note
In the second sample case the user wants to create a login consisting of three zeros. It's impossible due to collision with the third among the existing.
In the third sample case the new login is similar with the second one.
Submitted Solution:
```
s = input()
n = int(input())
b = False
for i in range(n):
col = 0
s1 = input()
if len(s1) == len(s):
for i in range(len(s1)):
if s1[i].upper() == s[i].upper():
col += 1
if s1[i].upper() == 'O' and s[i] == '0':
col += 1
if s1[i] == '0' and s[i].upper() == 'O':
col += 1
if s1[i].upper() == 'I' and s[i] == '1':
col += 1
if s1[i].upper() == 'L' and s[i] == '1':
col += 1
if s1[i] == '1' and s[i].upper() == 'I':
col += 1
if s1[i] == '1' and s[i].upper() == 'L':
col += 1
if s1[i].upper() == 'I' and s[i].upper() == 'L':
col += 1
if s[i].upper() == 'I' and s1[i].upper() == 'L':
col += 1
if col == len(s1):
b = True
break
if b:
print("No")
else:
print("Yes")
``` | instruction | 0 | 8,129 | 18 | 16,258 |
Yes | output | 1 | 8,129 | 18 | 16,259 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits and underline symbols («_»). However, in order to decrease the number of frauds and user-inattention related issues, it is prohibited to register a login if it is similar with an already existing login. More precisely, two logins s and t are considered similar if we can transform s to t via a sequence of operations of the following types:
* transform lowercase letters to uppercase and vice versa;
* change letter «O» (uppercase latin letter) to digit «0» and vice versa;
* change digit «1» (one) to any letter among «l» (lowercase latin «L»), «I» (uppercase latin «i») and vice versa, or change one of these letters to other.
For example, logins «Codeforces» and «codef0rces» as well as «OO0OOO00O0OOO0O00OOO0OO_lol» and «OO0OOO0O00OOO0O00OO0OOO_1oI» are considered similar whereas «Codeforces» and «Code_forces» are not.
You're given a list of existing logins with no two similar amonst and a newly created user login. Check whether this new login is similar with any of the existing ones.
Input
The first line contains a non-empty string s consisting of lower and uppercase latin letters, digits and underline symbols («_») with length not exceeding 50 — the login itself.
The second line contains a single integer n (1 ≤ n ≤ 1 000) — the number of existing logins.
The next n lines describe the existing logins, following the same constraints as the user login (refer to the first line of the input). It's guaranteed that no two existing logins are similar.
Output
Print «Yes» (without quotes), if user can register via this login, i.e. none of the existing logins is similar with it.
Otherwise print «No» (without quotes).
Examples
Input
1_wat
2
2_wat
wat_1
Output
Yes
Input
000
3
00
ooA
oOo
Output
No
Input
_i_
3
__i_
_1_
I
Output
No
Input
La0
3
2a0
La1
1a0
Output
No
Input
abc
1
aBc
Output
No
Input
0Lil
2
LIL0
0Ril
Output
Yes
Note
In the second sample case the user wants to create a login consisting of three zeros. It's impossible due to collision with the third among the existing.
In the third sample case the new login is similar with the second one.
Submitted Solution:
```
def transform(log):
return log.replace('O', '0').replace('o', '0').replace('l', '1').replace('I', '1').\
replace('L', '1').replace('i', '1').lower()
login = transform(input())
n = int(input())
logins = []
check = False
for i in range(n):
if login == transform(input()):
print('No')
check = True
if not check:
print('Yes')
``` | instruction | 0 | 8,130 | 18 | 16,260 |
Yes | output | 1 | 8,130 | 18 | 16,261 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits and underline symbols («_»). However, in order to decrease the number of frauds and user-inattention related issues, it is prohibited to register a login if it is similar with an already existing login. More precisely, two logins s and t are considered similar if we can transform s to t via a sequence of operations of the following types:
* transform lowercase letters to uppercase and vice versa;
* change letter «O» (uppercase latin letter) to digit «0» and vice versa;
* change digit «1» (one) to any letter among «l» (lowercase latin «L»), «I» (uppercase latin «i») and vice versa, or change one of these letters to other.
For example, logins «Codeforces» and «codef0rces» as well as «OO0OOO00O0OOO0O00OOO0OO_lol» and «OO0OOO0O00OOO0O00OO0OOO_1oI» are considered similar whereas «Codeforces» and «Code_forces» are not.
You're given a list of existing logins with no two similar amonst and a newly created user login. Check whether this new login is similar with any of the existing ones.
Input
The first line contains a non-empty string s consisting of lower and uppercase latin letters, digits and underline symbols («_») with length not exceeding 50 — the login itself.
The second line contains a single integer n (1 ≤ n ≤ 1 000) — the number of existing logins.
The next n lines describe the existing logins, following the same constraints as the user login (refer to the first line of the input). It's guaranteed that no two existing logins are similar.
Output
Print «Yes» (without quotes), if user can register via this login, i.e. none of the existing logins is similar with it.
Otherwise print «No» (without quotes).
Examples
Input
1_wat
2
2_wat
wat_1
Output
Yes
Input
000
3
00
ooA
oOo
Output
No
Input
_i_
3
__i_
_1_
I
Output
No
Input
La0
3
2a0
La1
1a0
Output
No
Input
abc
1
aBc
Output
No
Input
0Lil
2
LIL0
0Ril
Output
Yes
Note
In the second sample case the user wants to create a login consisting of three zeros. It's impossible due to collision with the third among the existing.
In the third sample case the new login is similar with the second one.
Submitted Solution:
```
alpha = 'qwertyupasdfghjkzxcvbnmQWERTYUPASDFGHJKZXCVBNM'
alikes = []
for i in range(len(alpha)):
alikes.append(set(alpha[i]))
alikes[-1].add(alpha[(i + 23)%46])
alikes.append(set(['0', 'o', 'O']))
alikes.append(set(['l', 'L', 'i', 'I', '1']))
for i in range(2, 10):
alikes.append(set(str(i)))
alikes.append(set('_'))
a = input()
check = False
for i in range(int(input())):
b = input()
if len(a) != len(b) or check:
continue
for j in range(len(a)):
newCheck = False
for k in alikes:
if a[j] in k:
if b[j] not in k:
newCheck = True
break
if newCheck:
break
check = (j == len(a) - 1)
print('No' if check else 'Yes')
``` | instruction | 0 | 8,131 | 18 | 16,262 |
Yes | output | 1 | 8,131 | 18 | 16,263 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits and underline symbols («_»). However, in order to decrease the number of frauds and user-inattention related issues, it is prohibited to register a login if it is similar with an already existing login. More precisely, two logins s and t are considered similar if we can transform s to t via a sequence of operations of the following types:
* transform lowercase letters to uppercase and vice versa;
* change letter «O» (uppercase latin letter) to digit «0» and vice versa;
* change digit «1» (one) to any letter among «l» (lowercase latin «L»), «I» (uppercase latin «i») and vice versa, or change one of these letters to other.
For example, logins «Codeforces» and «codef0rces» as well as «OO0OOO00O0OOO0O00OOO0OO_lol» and «OO0OOO0O00OOO0O00OO0OOO_1oI» are considered similar whereas «Codeforces» and «Code_forces» are not.
You're given a list of existing logins with no two similar amonst and a newly created user login. Check whether this new login is similar with any of the existing ones.
Input
The first line contains a non-empty string s consisting of lower and uppercase latin letters, digits and underline symbols («_») with length not exceeding 50 — the login itself.
The second line contains a single integer n (1 ≤ n ≤ 1 000) — the number of existing logins.
The next n lines describe the existing logins, following the same constraints as the user login (refer to the first line of the input). It's guaranteed that no two existing logins are similar.
Output
Print «Yes» (without quotes), if user can register via this login, i.e. none of the existing logins is similar with it.
Otherwise print «No» (without quotes).
Examples
Input
1_wat
2
2_wat
wat_1
Output
Yes
Input
000
3
00
ooA
oOo
Output
No
Input
_i_
3
__i_
_1_
I
Output
No
Input
La0
3
2a0
La1
1a0
Output
No
Input
abc
1
aBc
Output
No
Input
0Lil
2
LIL0
0Ril
Output
Yes
Note
In the second sample case the user wants to create a login consisting of three zeros. It's impossible due to collision with the third among the existing.
In the third sample case the new login is similar with the second one.
Submitted Solution:
```
def f(login1,login2):
s1 = login1.lower()
s2 = login2.lower()
if len(login1) != len(login2):
return False
else:
p = 0
for i in range(len(login1)):
if (s1[i] == s2[i])or((s1[i] == "o")and(s2[i] == "0"))or((s1[i] == "0")and(s2[i] == "o"))or((login1[i] == "1")and(login2[i] == "l"))or((login1[i] == "1")and(login2[i] == "I"))or((login2[i] == "1")and(s1[i] == "l"))or((login2[i] == "1")and(s1[i] == "i"))or((login2[i] == "l")and(s1[i] == "i"))or((s1[i] == "l")and(login2[i] == "I")):
p += 1
if p == len(s1):
return True
else:
return False
login = input()
n = int(input())
a =[]
q = True
for i in range(n):
new = input()
if f(login,new):
print("No")
q = False
break
if q:
print("Yes")
``` | instruction | 0 | 8,132 | 18 | 16,264 |
No | output | 1 | 8,132 | 18 | 16,265 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits and underline symbols («_»). However, in order to decrease the number of frauds and user-inattention related issues, it is prohibited to register a login if it is similar with an already existing login. More precisely, two logins s and t are considered similar if we can transform s to t via a sequence of operations of the following types:
* transform lowercase letters to uppercase and vice versa;
* change letter «O» (uppercase latin letter) to digit «0» and vice versa;
* change digit «1» (one) to any letter among «l» (lowercase latin «L»), «I» (uppercase latin «i») and vice versa, or change one of these letters to other.
For example, logins «Codeforces» and «codef0rces» as well as «OO0OOO00O0OOO0O00OOO0OO_lol» and «OO0OOO0O00OOO0O00OO0OOO_1oI» are considered similar whereas «Codeforces» and «Code_forces» are not.
You're given a list of existing logins with no two similar amonst and a newly created user login. Check whether this new login is similar with any of the existing ones.
Input
The first line contains a non-empty string s consisting of lower and uppercase latin letters, digits and underline symbols («_») with length not exceeding 50 — the login itself.
The second line contains a single integer n (1 ≤ n ≤ 1 000) — the number of existing logins.
The next n lines describe the existing logins, following the same constraints as the user login (refer to the first line of the input). It's guaranteed that no two existing logins are similar.
Output
Print «Yes» (without quotes), if user can register via this login, i.e. none of the existing logins is similar with it.
Otherwise print «No» (without quotes).
Examples
Input
1_wat
2
2_wat
wat_1
Output
Yes
Input
000
3
00
ooA
oOo
Output
No
Input
_i_
3
__i_
_1_
I
Output
No
Input
La0
3
2a0
La1
1a0
Output
No
Input
abc
1
aBc
Output
No
Input
0Lil
2
LIL0
0Ril
Output
Yes
Note
In the second sample case the user wants to create a login consisting of three zeros. It's impossible due to collision with the third among the existing.
In the third sample case the new login is similar with the second one.
Submitted Solution:
```
x=input()
x=x.lower()
n=int(input())
for i in range(n):
s1=input()
s1=s1.lower()
if len(s1) != len(x):
continue
for i in range(len(s1)):
if s1[i] != x[i]:
if x[i] == "0" and s1[i] == "o" or s1[i] == "o" and x[i] == "0":
continue
elif x[i] == "1" and (s1[i] == "l" or s1[i]=='i') or s1[i] == "1" and (x[i] == "l" or x[i]=='i'):
continue
else:
break
else:
print("No")
break
else:
print("Yes")
``` | instruction | 0 | 8,133 | 18 | 16,266 |
No | output | 1 | 8,133 | 18 | 16,267 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits and underline symbols («_»). However, in order to decrease the number of frauds and user-inattention related issues, it is prohibited to register a login if it is similar with an already existing login. More precisely, two logins s and t are considered similar if we can transform s to t via a sequence of operations of the following types:
* transform lowercase letters to uppercase and vice versa;
* change letter «O» (uppercase latin letter) to digit «0» and vice versa;
* change digit «1» (one) to any letter among «l» (lowercase latin «L»), «I» (uppercase latin «i») and vice versa, or change one of these letters to other.
For example, logins «Codeforces» and «codef0rces» as well as «OO0OOO00O0OOO0O00OOO0OO_lol» and «OO0OOO0O00OOO0O00OO0OOO_1oI» are considered similar whereas «Codeforces» and «Code_forces» are not.
You're given a list of existing logins with no two similar amonst and a newly created user login. Check whether this new login is similar with any of the existing ones.
Input
The first line contains a non-empty string s consisting of lower and uppercase latin letters, digits and underline symbols («_») with length not exceeding 50 — the login itself.
The second line contains a single integer n (1 ≤ n ≤ 1 000) — the number of existing logins.
The next n lines describe the existing logins, following the same constraints as the user login (refer to the first line of the input). It's guaranteed that no two existing logins are similar.
Output
Print «Yes» (without quotes), if user can register via this login, i.e. none of the existing logins is similar with it.
Otherwise print «No» (without quotes).
Examples
Input
1_wat
2
2_wat
wat_1
Output
Yes
Input
000
3
00
ooA
oOo
Output
No
Input
_i_
3
__i_
_1_
I
Output
No
Input
La0
3
2a0
La1
1a0
Output
No
Input
abc
1
aBc
Output
No
Input
0Lil
2
LIL0
0Ril
Output
Yes
Note
In the second sample case the user wants to create a login consisting of three zeros. It's impossible due to collision with the third among the existing.
In the third sample case the new login is similar with the second one.
Submitted Solution:
```
def corrector(w, p):
if w.upper() == p or w.lower() == p:
return "OK"
mas_0 = ["0", "O", "o"]
if (w in mas_0) and (p in mas_0):
return "OK"
mas_1 = ["1", "L", "l", "I", "i"]
if (w in mas_1) and (p in mas_1):
return "OK"
return "NOT"
def progress(present, wish):
position = 0
while position < len(present):
w = wish[position]
p = present[position]
ans = corrector(w, p)
if ans == "NOT":
return 1 # не смогли поменять букву
position += 1
return 0 # смогли поменять все букву
def main():
wish = str(input())
kol = int(input())
for i in range(kol):
present = str(input())
if present == wish:
print("No")
return 0
if len(present) == len(wish):
if progress(present, wish) == 0:
print("No")
return 0
else:
print("CHECk")
continue
print("Yes")
if __name__ == '__main__':
main()
``` | instruction | 0 | 8,134 | 18 | 16,268 |
No | output | 1 | 8,134 | 18 | 16,269 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits and underline symbols («_»). However, in order to decrease the number of frauds and user-inattention related issues, it is prohibited to register a login if it is similar with an already existing login. More precisely, two logins s and t are considered similar if we can transform s to t via a sequence of operations of the following types:
* transform lowercase letters to uppercase and vice versa;
* change letter «O» (uppercase latin letter) to digit «0» and vice versa;
* change digit «1» (one) to any letter among «l» (lowercase latin «L»), «I» (uppercase latin «i») and vice versa, or change one of these letters to other.
For example, logins «Codeforces» and «codef0rces» as well as «OO0OOO00O0OOO0O00OOO0OO_lol» and «OO0OOO0O00OOO0O00OO0OOO_1oI» are considered similar whereas «Codeforces» and «Code_forces» are not.
You're given a list of existing logins with no two similar amonst and a newly created user login. Check whether this new login is similar with any of the existing ones.
Input
The first line contains a non-empty string s consisting of lower and uppercase latin letters, digits and underline symbols («_») with length not exceeding 50 — the login itself.
The second line contains a single integer n (1 ≤ n ≤ 1 000) — the number of existing logins.
The next n lines describe the existing logins, following the same constraints as the user login (refer to the first line of the input). It's guaranteed that no two existing logins are similar.
Output
Print «Yes» (without quotes), if user can register via this login, i.e. none of the existing logins is similar with it.
Otherwise print «No» (without quotes).
Examples
Input
1_wat
2
2_wat
wat_1
Output
Yes
Input
000
3
00
ooA
oOo
Output
No
Input
_i_
3
__i_
_1_
I
Output
No
Input
La0
3
2a0
La1
1a0
Output
No
Input
abc
1
aBc
Output
No
Input
0Lil
2
LIL0
0Ril
Output
Yes
Note
In the second sample case the user wants to create a login consisting of three zeros. It's impossible due to collision with the third among the existing.
In the third sample case the new login is similar with the second one.
Submitted Solution:
```
def can_exist(login, existing_logins):
for word in existing_logins:
if len(word) == len(login):
for i in range(len(word)):
if word[i] == login[i]:
continue
elif word[i].replace('o', '0').replace('l', '1').replace('i', '1') ==\
login[i].replace('o', '0').replace('l', '1').replace('i', '1'):
continue
break
else:
return "No"
return "Yes"
if __name__ == '__main__':
login = input()
n = int(input())
existing_logins = list()
for i in range(n):
existing_logins.append(input().lower())
print(can_exist(login, existing_logins))
``` | instruction | 0 | 8,135 | 18 | 16,270 |
No | output | 1 | 8,135 | 18 | 16,271 |
Provide a correct Python 3 solution for this coding contest problem.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First | instruction | 0 | 8,293 | 18 | 16,586 |
"Correct Solution:
```
s = input()
print('First' if (len(s)%2) ^ (s[0] == s[-1]) else 'Second')
``` | output | 1 | 8,293 | 18 | 16,587 |
Provide a correct Python 3 solution for this coding contest problem.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First | instruction | 0 | 8,294 | 18 | 16,588 |
"Correct Solution:
```
S = input()
print('First' if (S[0] == S[-1]) ^ (len(S) % 2) else 'Second')
``` | output | 1 | 8,294 | 18 | 16,589 |
Provide a correct Python 3 solution for this coding contest problem.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First | instruction | 0 | 8,295 | 18 | 16,590 |
"Correct Solution:
```
s=input()
n=len(s)
if s[0]==s[n-1] and n%2==0 or s[0]!=s[n-1] and n%2==1:
print("First")
else:
print("Second")
``` | output | 1 | 8,295 | 18 | 16,591 |
Provide a correct Python 3 solution for this coding contest problem.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First | instruction | 0 | 8,296 | 18 | 16,592 |
"Correct Solution:
```
S = input()
if (len(S)%2)^(S[0]==S[-1]):
print("First")
else:
print("Second")
``` | output | 1 | 8,296 | 18 | 16,593 |
Provide a correct Python 3 solution for this coding contest problem.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First | instruction | 0 | 8,297 | 18 | 16,594 |
"Correct Solution:
```
s = input()
if (s[0] == s[-1] and len(s) % 2 == 0) or (s[0] != s[-1] and len(s) % 2 == 1):
print("First")
else:
print("Second")
``` | output | 1 | 8,297 | 18 | 16,595 |
Provide a correct Python 3 solution for this coding contest problem.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First | instruction | 0 | 8,298 | 18 | 16,596 |
"Correct Solution:
```
s = input()
ans=0
if s[0] == s[-1]:
ans +=1
ans = (len(s)-ans) %2
if ans == 0:
print("Second")
else:
print("First")
``` | output | 1 | 8,298 | 18 | 16,597 |
Provide a correct Python 3 solution for this coding contest problem.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First | instruction | 0 | 8,299 | 18 | 16,598 |
"Correct Solution:
```
s=input()
if s[0]==s[-1]:
print("Second" if len(s)%2 else "First")
else:
print("Second" if not len(s)%2 else "First")
``` | output | 1 | 8,299 | 18 | 16,599 |
Provide a correct Python 3 solution for this coding contest problem.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First | instruction | 0 | 8,300 | 18 | 16,600 |
"Correct Solution:
```
S = input()
L = len(S)%2==1
if S[0] != S[-1]:
print("Second" if not L else "First")
else:
print("Second" if L else "First")
``` | output | 1 | 8,300 | 18 | 16,601 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First
Submitted Solution:
```
S = input()
if S[0] != S[-1]:
if len(S) % 2 == 1:
print('First')
else:
print('Second')
else:
if len(S) % 2 == 1:
print('Second')
else:
print('First')
``` | instruction | 0 | 8,301 | 18 | 16,602 |
Yes | output | 1 | 8,301 | 18 | 16,603 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First
Submitted Solution:
```
s=list(input())
n=len(s)
n=n-2
if s[0]==s[-1]:
n-=1
if n%2==0:
print("Second")
else:
print("First")
``` | instruction | 0 | 8,302 | 18 | 16,604 |
Yes | output | 1 | 8,302 | 18 | 16,605 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First
Submitted Solution:
```
s = input()
if s[0] == s[-1] and len(s) % 2 == 1 or s[0] != s[-1] and len(s) % 2 == 0: print('Second')
else: print('First')
``` | instruction | 0 | 8,303 | 18 | 16,606 |
Yes | output | 1 | 8,303 | 18 | 16,607 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First
Submitted Solution:
```
s = input()
N = len(s)
f, l = (s[0], s[N-1])
if f == l:
if N%2 == 0:
print("First")
else:
print("Second")
else:
if N%2 == 0:
print("Second")
else:
print("First")
``` | instruction | 0 | 8,304 | 18 | 16,608 |
Yes | output | 1 | 8,304 | 18 | 16,609 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First
Submitted Solution:
```
s = list(input())
str_count = 0
for char in s:
if char == s[0] or char == s[-1]:
str_count += 1
if s[0] == s[-1]:
available_char_num = len(s) - str_count -1
else:
available_char_num = len(s) - 2
if available_char_num % 2 == 0:
print("Second")
else:
print("First")
``` | instruction | 0 | 8,305 | 18 | 16,610 |
No | output | 1 | 8,305 | 18 | 16,611 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.
The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.
Constraints
* 3 ≤ |s| ≤ 10^5
* s consists of lowercase English letters.
* No two neighboring characters in s are equal.
Input
The input is given from Standard Input in the following format:
s
Output
If Takahashi will win, print `First`. If Aoki will win, print `Second`.
Examples
Input
aba
Output
Second
Input
abc
Output
First
Input
abcab
Output
First
Submitted Solution:
```
S = input()
N = len(S)
x = S[0]
y = S[1]
for i in range(2, N):
if i % 2 == 0:
if S[i] != x:
break
else:
if S[i] != y:
break
else:
print("Second")
exit()
if N % 2 == 0:
print("Second")
else:
print("First")
``` | instruction | 0 | 8,306 | 18 | 16,612 |
No | output | 1 | 8,306 | 18 | 16,613 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.