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.
Short Phrase
A Short Phrase (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition:
> (The Condition for a Short Phrase)
> The sequence of words can be divided into five sections such that the total number of the letters in the word(s) of the first section is five, that of the second is seven, and those of the rest are five, seven, and seven, respectively.
The following is an example of a Short Phrase.
>
> do the best
> and enjoy today
> at acm icpc
>
In this example, the sequence of the nine words can be divided into five sections (1) "do" and "the", (2) "best" and "and", (3) "enjoy", (4) "today" and "at", and (5) "acm" and "icpc" such that they have 5, 7, 5, 7, and 7 letters in this order, respectively. This surely satisfies the condition of a Short Phrase.
Now, Short Phrase Parnassus published by your company has received a lot of contributions. By an unfortunate accident, however, some irrelevant texts seem to be added at beginnings and ends of contributed Short Phrases. Your mission is to write a program that finds the Short Phrase from a sequence of words that may have an irrelevant prefix and/or a suffix.
Input
The input consists of multiple datasets, each in the following format.
> n
> w1
> ...
> wn
>
Here, n is the number of words, which is a positive integer not exceeding 40; wi is the i-th word, consisting solely of lowercase letters from 'a' to 'z'. The length of each word is between 1 and 10, inclusive. You can assume that every dataset includes a Short Phrase.
The end of the input is indicated by a line with a single zero.
Output
For each dataset, output a single line containing i where the first word of the Short Phrase is wi. When multiple Short Phrases occur in the dataset, you should output the first one.
Sample Input
9
do
the
best
and
enjoy
today
at
acm
icpc
14
oh
yes
by
far
it
is
wow
so
bad
to
me
you
know
hey
15
abcde
fghijkl
mnopq
rstuvwx
yzz
abcde
fghijkl
mnopq
rstuvwx
yz
abcde
fghijkl
mnopq
rstuvwx
yz
0
Output for the Sample Input
1
2
6
Example
Input
9
do
the
best
and
enjoy
today
at
acm
icpc
14
oh
yes
by
far
it
is
wow
so
bad
to
me
you
know
hey
15
abcde
fghijkl
mnopq
rstuvwx
yzz
abcde
fghijkl
mnopq
rstuvwx
yz
abcde
fghijkl
mnopq
rstuvwx
yz
0
Output
1
2
6
Submitted Solution:
```
while True :
n = int(input())
if(n == 0) :
break
else :
A = [5, 7, 5, 7, 7]
ans = 0
w = [len(input()) for i in range(n)]
for i in range(n) :
k = 0
s = 0
for j in range(i, n) :
s += w[j]
if(s == A[k]) :
s = 0
k += 1
if(k == 5) :
ans = i + 1
break
elif(s > A[k]) :
break
if(ans != 0) :
break
print(ans)
``` | instruction | 0 | 86,506 | 18 | 173,012 |
No | output | 1 | 86,506 | 18 | 173,013 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out to be encrypted. The detective tried really hard to decipher the correspondence, but he couldn't understand anything.
At last, after some thought, he thought of something. Let's say there is a word s, consisting of |s| lowercase Latin letters. Then for one operation you can choose a certain position p (1 β€ p < |s|) and perform one of the following actions:
* either replace letter sp with the one that alphabetically follows it and replace letter sp + 1 with the one that alphabetically precedes it;
* or replace letter sp with the one that alphabetically precedes it and replace letter sp + 1 with the one that alphabetically follows it.
Let us note that letter "z" doesn't have a defined following letter and letter "a" doesn't have a defined preceding letter. That's why the corresponding changes are not acceptable. If the operation requires performing at least one unacceptable change, then such operation cannot be performed.
Two words coincide in their meaning iff one of them can be transformed into the other one as a result of zero or more operations.
Sherlock Holmes needs to learn to quickly determine the following for each word: how many words can exist that coincide in their meaning with the given word, but differs from the given word in at least one character? Count this number for him modulo 1000000007 (109 + 7).
Input
The input data contains several tests. The first line contains the only integer t (1 β€ t β€ 104) β the number of tests.
Next t lines contain the words, one per line. Each word consists of lowercase Latin letters and has length from 1 to 100, inclusive. Lengths of words can differ.
Output
For each word you should print the number of different other words that coincide with it in their meaning β not from the words listed in the input data, but from all possible words. As the sought number can be very large, print its value modulo 1000000007 (109 + 7).
Examples
Input
1
ab
Output
1
Input
1
aaaaaaaaaaa
Output
0
Input
2
ya
klmbfxzb
Output
24
320092793
Note
Some explanations about the operation:
* Note that for each letter, we can clearly define the letter that follows it. Letter "b" alphabetically follows letter "a", letter "c" follows letter "b", ..., "z" follows letter "y".
* Preceding letters are defined in the similar manner: letter "y" precedes letter "z", ..., "a" precedes letter "b".
* Note that the operation never changes a word's length.
In the first sample you can obtain the only other word "ba". In the second sample you cannot obtain any other word, so the correct answer is 0.
Consider the third sample. One operation can transform word "klmbfxzb" into word "klmcexzb": we should choose p = 4, and replace the fourth letter with the following one ("b" β "c"), and the fifth one β with the preceding one ("f" β "e"). Also, we can obtain many other words from this one. An operation can transform word "ya" only into one other word "xb".
Word "ya" coincides in its meaning with words "xb", "wc", "vd", ..., "ay" (overall there are 24 other words). The word "klmbfxzb has many more variants β there are 3320092814 other words that coincide with in the meaning. So the answer for the first word equals 24 and for the second one equals 320092793 β the number 3320092814 modulo 109 + 7
Submitted Solution:
```
S, N = 2501, 101
m = 1000000007
k = 26
p = [[0] * (S + k) for i in range(N)]
p[0][0] = 1
for n in range(1, N):
for s in range(S):
p[n][s] = (p[n][s - 1] + p[n - 1][s] - p[n - 1][s - k]) % m
d = [0] * S
r = []
for j in range(int(input())):
t = input()
n, s = len(t), sum(ord(q) - 97 for q in t)
d[s] += 1
r.append((n, s))
for n, s in r: print(p[n][s] - d[s])
``` | instruction | 0 | 86,904 | 18 | 173,808 |
No | output | 1 | 86,904 | 18 | 173,809 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out to be encrypted. The detective tried really hard to decipher the correspondence, but he couldn't understand anything.
At last, after some thought, he thought of something. Let's say there is a word s, consisting of |s| lowercase Latin letters. Then for one operation you can choose a certain position p (1 β€ p < |s|) and perform one of the following actions:
* either replace letter sp with the one that alphabetically follows it and replace letter sp + 1 with the one that alphabetically precedes it;
* or replace letter sp with the one that alphabetically precedes it and replace letter sp + 1 with the one that alphabetically follows it.
Let us note that letter "z" doesn't have a defined following letter and letter "a" doesn't have a defined preceding letter. That's why the corresponding changes are not acceptable. If the operation requires performing at least one unacceptable change, then such operation cannot be performed.
Two words coincide in their meaning iff one of them can be transformed into the other one as a result of zero or more operations.
Sherlock Holmes needs to learn to quickly determine the following for each word: how many words can exist that coincide in their meaning with the given word, but differs from the given word in at least one character? Count this number for him modulo 1000000007 (109 + 7).
Input
The input data contains several tests. The first line contains the only integer t (1 β€ t β€ 104) β the number of tests.
Next t lines contain the words, one per line. Each word consists of lowercase Latin letters and has length from 1 to 100, inclusive. Lengths of words can differ.
Output
For each word you should print the number of different other words that coincide with it in their meaning β not from the words listed in the input data, but from all possible words. As the sought number can be very large, print its value modulo 1000000007 (109 + 7).
Examples
Input
1
ab
Output
1
Input
1
aaaaaaaaaaa
Output
0
Input
2
ya
klmbfxzb
Output
24
320092793
Note
Some explanations about the operation:
* Note that for each letter, we can clearly define the letter that follows it. Letter "b" alphabetically follows letter "a", letter "c" follows letter "b", ..., "z" follows letter "y".
* Preceding letters are defined in the similar manner: letter "y" precedes letter "z", ..., "a" precedes letter "b".
* Note that the operation never changes a word's length.
In the first sample you can obtain the only other word "ba". In the second sample you cannot obtain any other word, so the correct answer is 0.
Consider the third sample. One operation can transform word "klmbfxzb" into word "klmcexzb": we should choose p = 4, and replace the fourth letter with the following one ("b" β "c"), and the fifth one β with the preceding one ("f" β "e"). Also, we can obtain many other words from this one. An operation can transform word "ya" only into one other word "xb".
Word "ya" coincides in its meaning with words "xb", "wc", "vd", ..., "ay" (overall there are 24 other words). The word "klmbfxzb has many more variants β there are 3320092814 other words that coincide with in the meaning. So the answer for the first word equals 24 and for the second one equals 320092793 β the number 3320092814 modulo 109 + 7
Submitted Solution:
```
S, N = 2505, 105
m = 100000007
k = 26
p = [[0] * (S + k) for i in range(N)]
p[0][0] = 1
for n in range(1, N):
for s in range(S):
p[n][s] = (p[n][s - 1] + p[n - 1][s] - p[n - 1][s - k]) % m
r = []
for j in range(int(input())):
t = input()
s = sum(ord(q) - 97 for q in t)
print(p[len(t)][s] - 1)
``` | instruction | 0 | 86,905 | 18 | 173,810 |
No | output | 1 | 86,905 | 18 | 173,811 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out to be encrypted. The detective tried really hard to decipher the correspondence, but he couldn't understand anything.
At last, after some thought, he thought of something. Let's say there is a word s, consisting of |s| lowercase Latin letters. Then for one operation you can choose a certain position p (1 β€ p < |s|) and perform one of the following actions:
* either replace letter sp with the one that alphabetically follows it and replace letter sp + 1 with the one that alphabetically precedes it;
* or replace letter sp with the one that alphabetically precedes it and replace letter sp + 1 with the one that alphabetically follows it.
Let us note that letter "z" doesn't have a defined following letter and letter "a" doesn't have a defined preceding letter. That's why the corresponding changes are not acceptable. If the operation requires performing at least one unacceptable change, then such operation cannot be performed.
Two words coincide in their meaning iff one of them can be transformed into the other one as a result of zero or more operations.
Sherlock Holmes needs to learn to quickly determine the following for each word: how many words can exist that coincide in their meaning with the given word, but differs from the given word in at least one character? Count this number for him modulo 1000000007 (109 + 7).
Input
The input data contains several tests. The first line contains the only integer t (1 β€ t β€ 104) β the number of tests.
Next t lines contain the words, one per line. Each word consists of lowercase Latin letters and has length from 1 to 100, inclusive. Lengths of words can differ.
Output
For each word you should print the number of different other words that coincide with it in their meaning β not from the words listed in the input data, but from all possible words. As the sought number can be very large, print its value modulo 1000000007 (109 + 7).
Examples
Input
1
ab
Output
1
Input
1
aaaaaaaaaaa
Output
0
Input
2
ya
klmbfxzb
Output
24
320092793
Note
Some explanations about the operation:
* Note that for each letter, we can clearly define the letter that follows it. Letter "b" alphabetically follows letter "a", letter "c" follows letter "b", ..., "z" follows letter "y".
* Preceding letters are defined in the similar manner: letter "y" precedes letter "z", ..., "a" precedes letter "b".
* Note that the operation never changes a word's length.
In the first sample you can obtain the only other word "ba". In the second sample you cannot obtain any other word, so the correct answer is 0.
Consider the third sample. One operation can transform word "klmbfxzb" into word "klmcexzb": we should choose p = 4, and replace the fourth letter with the following one ("b" β "c"), and the fifth one β with the preceding one ("f" β "e"). Also, we can obtain many other words from this one. An operation can transform word "ya" only into one other word "xb".
Word "ya" coincides in its meaning with words "xb", "wc", "vd", ..., "ay" (overall there are 24 other words). The word "klmbfxzb has many more variants β there are 3320092814 other words that coincide with in the meaning. So the answer for the first word equals 24 and for the second one equals 320092793 β the number 3320092814 modulo 109 + 7
Submitted Solution:
```
S, N = 2501, 101
m = 1000000007
k = 26
p = [[0] * (S + k) for i in range(N)]
p[0][0] = 1
for n in range(1, N):
for s in range(S):
p[n][s] = (p[n][s - 1] + p[n - 1][s] - p[n - 1][s - k]) % m
d = [0] * (S * N)
r = []
for j in range(int(input())):
t = input()
n, s = len(t), sum(ord(q) - 97 for q in t)
d[s * N + n] += 1
r.append((n, s))
for n, s in r: print(p[n][s] - d[s * N + n])
``` | instruction | 0 | 86,906 | 18 | 173,812 |
No | output | 1 | 86,906 | 18 | 173,813 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt | instruction | 0 | 87,304 | 18 | 174,608 |
"Correct Solution:
```
k = int(input())
s = input()
if k >= len(s):
print(s)
else:
print(s[:k]+'...')
``` | output | 1 | 87,304 | 18 | 174,609 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt | instruction | 0 | 87,305 | 18 | 174,610 |
"Correct Solution:
```
k=int(input())
w=input()
if len(w)<=k:
print(w)
else:
print(w[:k]+"...")
``` | output | 1 | 87,305 | 18 | 174,611 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt | instruction | 0 | 87,306 | 18 | 174,612 |
"Correct Solution:
```
k=int(input())
s=input().strip()
print(s if len(s)<=k else s[:k]+'...')
``` | output | 1 | 87,306 | 18 | 174,613 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt | instruction | 0 | 87,307 | 18 | 174,614 |
"Correct Solution:
```
n = int(input())
txt = input()
print(txt[:n]+"..." if bool(txt[n:]) else txt)
``` | output | 1 | 87,307 | 18 | 174,615 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt | instruction | 0 | 87,309 | 18 | 174,618 |
"Correct Solution:
```
N=int(input())
S=input()
if len(S)<=N:
print(S)
else:
print(S[0:N]+"...")
``` | output | 1 | 87,309 | 18 | 174,619 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt | instruction | 0 | 87,310 | 18 | 174,620 |
"Correct Solution:
```
k=int(input())
s=input()
if k>=len(s):
print(s)
else:
print(s[:k]+"...")
``` | output | 1 | 87,310 | 18 | 174,621 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt
Submitted Solution:
```
k = int(input())
s = input()
print(s) if len(s) <= k else print(s[:k] + '...')
``` | instruction | 0 | 87,312 | 18 | 174,624 |
Yes | output | 1 | 87,312 | 18 | 174,625 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt
Submitted Solution:
```
K=int(input())
S=input()
a=len(S)
if a<=K:
print(S)
else:
print(S[:K]+'...')
``` | instruction | 0 | 87,313 | 18 | 174,626 |
Yes | output | 1 | 87,313 | 18 | 174,627 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt
Submitted Solution:
```
k=int(input())
s=input()
x=s[:k]+'...'*(len(s)>k)
print(x)
``` | instruction | 0 | 87,314 | 18 | 174,628 |
Yes | output | 1 | 87,314 | 18 | 174,629 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt
Submitted Solution:
```
k = int(input())
s = input()
if(len(s) <= k):
print(s)
else:
print(s[:k]+"...")
``` | instruction | 0 | 87,315 | 18 | 174,630 |
Yes | output | 1 | 87,315 | 18 | 174,631 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt
Submitted Solution:
```
K = int(input())
S = input()
if len(S) < K:
print(K)
else:
print(S[:K] + "...")
``` | instruction | 0 | 87,316 | 18 | 174,632 |
No | output | 1 | 87,316 | 18 | 174,633 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt
Submitted Solution:
```
K = int(input())
S = str(input())
SK = S[0 : (K)]
if len(S) <= K:
answer = S
else:
print(SK + '...')
``` | instruction | 0 | 87,317 | 18 | 174,634 |
No | output | 1 | 87,317 | 18 | 174,635 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt
Submitted Solution:
```
K = input()
S = input()
if len(K) >= len(S):
print(S)
else:
strings = str(S[:K]) + '...'
print(strings)
``` | instruction | 0 | 87,318 | 18 | 174,636 |
No | output | 1 | 87,318 | 18 | 174,637 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constraints
* K is an integer between 1 and 100 (inclusive).
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
K
S
Output
Print a string as stated in Problem Statement.
Examples
Input
7
nikoandsolstice
Output
nikoand...
Input
40
ferelibenterhominesidquodvoluntcredunt
Output
ferelibenterhominesidquodvoluntcredunt
Submitted Solution:
```
k=int(input())
s=str(input())
if len(s)<=k:
print(s)
else:
print(s[:k],"...")
``` | instruction | 0 | 87,319 | 18 | 174,638 |
No | output | 1 | 87,319 | 18 | 174,639 |
Provide a correct Python 3 solution for this coding contest problem.
problem
There is a mysterious device $ M $, and if you put Tanuki and Fox in this device, one animal will come out from the device (hereinafter, Tanuki will be $ T $ and Fox will be $ F $).
$ M (x, y) $ represents an animal that came out by putting animals in the device $ M $ in the order of $ x, y $.
As a result of various trials, the following was found.
$ M (T, T) = T $
$ M (T, F) = F $
$ M (F, T) = T $
$ M (F, F) = T $
You put the animals in a row $ P_1, P_2, ..., P_N $ into the device as follows.
$ M (.... M (M (P_1, P_2), P_3) ...., P_N) $
Answer the last animal that appears.
output
Output the last animal character $ T $ or $ F $, and also a newline at the end.
Example
Input
3
F T T
Output
T | instruction | 0 | 87,485 | 18 | 174,970 |
"Correct Solution:
```
N=int(input())
kekka=list(input().split())
#print(kekka)
base=kekka[0]
#result=0
for i in range(1,N):
if base=="F":
base="T"
#print(1)
elif base=="T":
if kekka[i]=="T":
base="T"
#print(2)
else:
base="F"
#print(3)
print(base)
``` | output | 1 | 87,485 | 18 | 174,971 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
problem
There is a mysterious device $ M $, and if you put Tanuki and Fox in this device, one animal will come out from the device (hereinafter, Tanuki will be $ T $ and Fox will be $ F $).
$ M (x, y) $ represents an animal that came out by putting animals in the device $ M $ in the order of $ x, y $.
As a result of various trials, the following was found.
$ M (T, T) = T $
$ M (T, F) = F $
$ M (F, T) = T $
$ M (F, F) = T $
You put the animals in a row $ P_1, P_2, ..., P_N $ into the device as follows.
$ M (.... M (M (P_1, P_2), P_3) ...., P_N) $
Answer the last animal that appears.
output
Output the last animal character $ T $ or $ F $, and also a newline at the end.
Example
Input
3
F T T
Output
T
Submitted Solution:
```
def M(i,j):
return "F" if i=="T" and j=="F" else "T"
n = int(input())
p = input().split()
ret = p[0]
for i in range(1,n):
ret = M(ret,p[i])
print(ret)
``` | instruction | 0 | 87,487 | 18 | 174,974 |
Yes | output | 1 | 87,487 | 18 | 174,975 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
problem
There is a mysterious device $ M $, and if you put Tanuki and Fox in this device, one animal will come out from the device (hereinafter, Tanuki will be $ T $ and Fox will be $ F $).
$ M (x, y) $ represents an animal that came out by putting animals in the device $ M $ in the order of $ x, y $.
As a result of various trials, the following was found.
$ M (T, T) = T $
$ M (T, F) = F $
$ M (F, T) = T $
$ M (F, F) = T $
You put the animals in a row $ P_1, P_2, ..., P_N $ into the device as follows.
$ M (.... M (M (P_1, P_2), P_3) ...., P_N) $
Answer the last animal that appears.
output
Output the last animal character $ T $ or $ F $, and also a newline at the end.
Example
Input
3
F T T
Output
T
Submitted Solution:
```
# /usr/bin/python
# -*- coding: utf-8 -*-
import sys
def machine(x,y):
if x=='T' and y=='F':
return 'F'
else:
return 'T'
N = int(input())
Pn = list(map(str, sys.stdin.readline().rstrip().split()))
for i in range(1, N):
Pn[i] = machine(Pn[i-1], Pn[i])
print(Pn[-1])
``` | instruction | 0 | 87,488 | 18 | 174,976 |
Yes | output | 1 | 87,488 | 18 | 174,977 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observation of Siddhantβs sentences, Yash determined a new cipher technique.
For a given sentence, the cipher is processed as:
1. Convert all letters of the sentence to lowercase.
2. Reverse each of the words of the sentence individually.
3. Remove all the spaces in the sentence.
For example, when this cipher is applied to the sentence
Kira is childish and he hates losing
the resulting string is
ariksihsidlihcdnaehsetahgnisol
Now Yash is given some ciphered string and a list of words. Help him to find out any original sentence composed using only words from the list. Note, that any of the given words could be used in the sentence multiple times.
Input
The first line of the input contains a single integer n (1 β€ n β€ 10 000) β the length of the ciphered text. The second line consists of n lowercase English letters β the ciphered text t.
The third line contains a single integer m (1 β€ m β€ 100 000) β the number of words which will be considered while deciphering the text. Each of the next m lines contains a non-empty word wi (|wi| β€ 1 000) consisting of uppercase and lowercase English letters only. It's guaranteed that the total length of all words doesn't exceed 1 000 000.
Output
Print one line β the original sentence. It is guaranteed that at least one solution exists. If there are multiple solutions, you may output any of those.
Examples
Input
30
ariksihsidlihcdnaehsetahgnisol
10
Kira
hates
is
he
losing
death
childish
L
and
Note
Output
Kira is childish and he hates losing
Input
12
iherehtolleh
5
HI
Ho
there
HeLLo
hello
Output
HI there HeLLo
Note
In sample case 2 there may be multiple accepted outputs, "HI there HeLLo" and "HI there hello" you may output any of them.
Submitted Solution:
```
lol = int(input())
data = input()
n = int(input())
dic = dict()
for i in range(n):
t = input()
c_t = ''
for i in t:
c_t = i + c_t
dic[data.find(c_t.lower())] = t
now = 0
while now < len(data):
try:
print(dic[now], end=' ')
except:
pass
else:
now = now + len(dic[now])
now += 1
``` | instruction | 0 | 87,996 | 18 | 175,992 |
No | output | 1 | 87,996 | 18 | 175,993 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observation of Siddhantβs sentences, Yash determined a new cipher technique.
For a given sentence, the cipher is processed as:
1. Convert all letters of the sentence to lowercase.
2. Reverse each of the words of the sentence individually.
3. Remove all the spaces in the sentence.
For example, when this cipher is applied to the sentence
Kira is childish and he hates losing
the resulting string is
ariksihsidlihcdnaehsetahgnisol
Now Yash is given some ciphered string and a list of words. Help him to find out any original sentence composed using only words from the list. Note, that any of the given words could be used in the sentence multiple times.
Input
The first line of the input contains a single integer n (1 β€ n β€ 10 000) β the length of the ciphered text. The second line consists of n lowercase English letters β the ciphered text t.
The third line contains a single integer m (1 β€ m β€ 100 000) β the number of words which will be considered while deciphering the text. Each of the next m lines contains a non-empty word wi (|wi| β€ 1 000) consisting of uppercase and lowercase English letters only. It's guaranteed that the total length of all words doesn't exceed 1 000 000.
Output
Print one line β the original sentence. It is guaranteed that at least one solution exists. If there are multiple solutions, you may output any of those.
Examples
Input
30
ariksihsidlihcdnaehsetahgnisol
10
Kira
hates
is
he
losing
death
childish
L
and
Note
Output
Kira is childish and he hates losing
Input
12
iherehtolleh
5
HI
Ho
there
HeLLo
hello
Output
HI there HeLLo
Note
In sample case 2 there may be multiple accepted outputs, "HI there HeLLo" and "HI there hello" you may output any of them.
Submitted Solution:
```
def make_trie(words):
root = dict()
for word in words:
current_dict = root
for letter in word:
current_dict = current_dict.setdefault(letter, {})
current_dict['$'] = '$'
return root
def find(trie, string):
My_List = []
My_Dic = trie
counter = 0
if counter > string.__len__()-1:
return []
if string[counter] in My_Dic:
My_Dic = My_Dic[string[counter]]
else:
return False
while '$' not in My_Dic or len(My_Dic) >= 1:
if '$' in My_Dic:
string1 = string[:counter+1]
string2 = string[counter+1:]
My_List.append(string1)
recresult = find(trie, string2)
if recresult is not False:
return My_List + recresult
counter += 1
if counter > string.__len__()-1:
return []
if string[counter] in My_Dic:
My_Dic = My_Dic[string[counter]]
else:
return False
lalist=[]
input()
str1=input()
x=input()
for i in range(int(x)):
lalist.append(input().lower()[::-1])
lalist2=find(make_trie(lalist),str1)
lalist3 =[]
for j in lalist2:
lalist3.append(j[::-1])
print(lalist3)
``` | instruction | 0 | 87,997 | 18 | 175,994 |
No | output | 1 | 87,997 | 18 | 175,995 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observation of Siddhantβs sentences, Yash determined a new cipher technique.
For a given sentence, the cipher is processed as:
1. Convert all letters of the sentence to lowercase.
2. Reverse each of the words of the sentence individually.
3. Remove all the spaces in the sentence.
For example, when this cipher is applied to the sentence
Kira is childish and he hates losing
the resulting string is
ariksihsidlihcdnaehsetahgnisol
Now Yash is given some ciphered string and a list of words. Help him to find out any original sentence composed using only words from the list. Note, that any of the given words could be used in the sentence multiple times.
Input
The first line of the input contains a single integer n (1 β€ n β€ 10 000) β the length of the ciphered text. The second line consists of n lowercase English letters β the ciphered text t.
The third line contains a single integer m (1 β€ m β€ 100 000) β the number of words which will be considered while deciphering the text. Each of the next m lines contains a non-empty word wi (|wi| β€ 1 000) consisting of uppercase and lowercase English letters only. It's guaranteed that the total length of all words doesn't exceed 1 000 000.
Output
Print one line β the original sentence. It is guaranteed that at least one solution exists. If there are multiple solutions, you may output any of those.
Examples
Input
30
ariksihsidlihcdnaehsetahgnisol
10
Kira
hates
is
he
losing
death
childish
L
and
Note
Output
Kira is childish and he hates losing
Input
12
iherehtolleh
5
HI
Ho
there
HeLLo
hello
Output
HI there HeLLo
Note
In sample case 2 there may be multiple accepted outputs, "HI there HeLLo" and "HI there hello" you may output any of them.
Submitted Solution:
```
lol = input()
data = input()
right_data = ''
for l in data:
right_data = l + right_data
# print(right_data)
N = int(input())
for i in range(N):
t = input()
if t.lower() in right_data:
print(t, end='')
``` | instruction | 0 | 87,998 | 18 | 175,996 |
No | output | 1 | 87,998 | 18 | 175,997 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observation of Siddhantβs sentences, Yash determined a new cipher technique.
For a given sentence, the cipher is processed as:
1. Convert all letters of the sentence to lowercase.
2. Reverse each of the words of the sentence individually.
3. Remove all the spaces in the sentence.
For example, when this cipher is applied to the sentence
Kira is childish and he hates losing
the resulting string is
ariksihsidlihcdnaehsetahgnisol
Now Yash is given some ciphered string and a list of words. Help him to find out any original sentence composed using only words from the list. Note, that any of the given words could be used in the sentence multiple times.
Input
The first line of the input contains a single integer n (1 β€ n β€ 10 000) β the length of the ciphered text. The second line consists of n lowercase English letters β the ciphered text t.
The third line contains a single integer m (1 β€ m β€ 100 000) β the number of words which will be considered while deciphering the text. Each of the next m lines contains a non-empty word wi (|wi| β€ 1 000) consisting of uppercase and lowercase English letters only. It's guaranteed that the total length of all words doesn't exceed 1 000 000.
Output
Print one line β the original sentence. It is guaranteed that at least one solution exists. If there are multiple solutions, you may output any of those.
Examples
Input
30
ariksihsidlihcdnaehsetahgnisol
10
Kira
hates
is
he
losing
death
childish
L
and
Note
Output
Kira is childish and he hates losing
Input
12
iherehtolleh
5
HI
Ho
there
HeLLo
hello
Output
HI there HeLLo
Note
In sample case 2 there may be multiple accepted outputs, "HI there HeLLo" and "HI there hello" you may output any of them.
Submitted Solution:
```
n = int(input())
t = input()
d = {}
for i in range(int(input())):
q = input()
d[q.lower()[::-1]] = q
s = [[]] + [None] * n
for i in range(n):
if s[i] is not None:
for q in d:
if t.startswith(q, i):
s[i + len(q)] = s[i] + [q]
print(*s[n])
``` | instruction | 0 | 87,999 | 18 | 175,998 |
No | output | 1 | 87,999 | 18 | 175,999 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA | instruction | 0 | 88,209 | 18 | 176,418 |
"Correct Solution:
```
S = input()
if S[0]=='A' and S[2:-1].count('C')==1 and (S[1:S.find('C')]+S[S.find('C')+1:]).islower():
print('AC')
else:
print('WA')
``` | output | 1 | 88,209 | 18 | 176,419 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA | instruction | 0 | 88,210 | 18 | 176,420 |
"Correct Solution:
```
s=input();print('WAAC'['A'==s[0] and s[2:-1].count('C')==1 and s.replace('A','').replace('C','').islower()::2])
``` | output | 1 | 88,210 | 18 | 176,421 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA | instruction | 0 | 88,211 | 18 | 176,422 |
"Correct Solution:
```
S=input()
print("AC" if "C" in S[2:-1] and "A" in S and S[1:].replace("C","",1).islower() else "WA")
``` | output | 1 | 88,211 | 18 | 176,423 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA | instruction | 0 | 88,212 | 18 | 176,424 |
"Correct Solution:
```
s=input()
if 'A' in s and 'C' in s[2:-1] and s[1:].replace('C','',1).islower()==True:
print('AC')
else:
print('WA')
``` | output | 1 | 88,212 | 18 | 176,425 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA | instruction | 0 | 88,213 | 18 | 176,426 |
"Correct Solution:
```
S=input()
judge = "AC" if (S[0] == 'A' and S[2:-1].count('C') == 1 and S[1:].replace('C', '').islower()) else "WA"
print(judge)
``` | output | 1 | 88,213 | 18 | 176,427 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA | instruction | 0 | 88,214 | 18 | 176,428 |
"Correct Solution:
```
import re
p = re.compile(r'^A[a-z]{1,}C[a-z]{1,}$')
S = input()
if bool(p.match(S)):
print('AC')
else:
print('WA')
``` | output | 1 | 88,214 | 18 | 176,429 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA | instruction | 0 | 88,215 | 18 | 176,430 |
"Correct Solution:
```
S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1 and S.replace('A', '').replace('C', '').islower():
print('AC')
else:
print('WA')
``` | output | 1 | 88,215 | 18 | 176,431 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA | instruction | 0 | 88,216 | 18 | 176,432 |
"Correct Solution:
```
i = input()
if i[0]=="A"and i[2:-1].count("C")==1\
and i[1:].replace("C","c",1).islower()==True:
print("AC")
else:print("WA")
``` | output | 1 | 88,216 | 18 | 176,433 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA
Submitted Solution:
```
import re
S = input()
if re.match(r'^A[a-z][a-z]*?C[a-z]*?[a-z]$', S):
print('AC')
else:
print('WA')
``` | instruction | 0 | 88,217 | 18 | 176,434 |
Yes | output | 1 | 88,217 | 18 | 176,435 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA
Submitted Solution:
```
s = input()
print("AC" if s[0] == "A" and s[2:len(s)-1].count("C") == 1 and s[1:].replace("C","",1).islower() else "WA")
``` | instruction | 0 | 88,218 | 18 | 176,436 |
Yes | output | 1 | 88,218 | 18 | 176,437 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA
Submitted Solution:
```
import re
S = input().strip()
print('AC' if re.match(r'^A[a-z]+C[a-z]+$', S) else 'WA')
``` | instruction | 0 | 88,219 | 18 | 176,438 |
Yes | output | 1 | 88,219 | 18 | 176,439 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA
Submitted Solution:
```
s = input()
if s[0]=="A" and s[2:-1].count("C")==1 and s[1:].replace("C","a",1).islower()==True:
print('AC')
else:
print('WA')
``` | instruction | 0 | 88,220 | 18 | 176,440 |
Yes | output | 1 | 88,220 | 18 | 176,441 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA
Submitted Solution:
```
s=input()
ans = True
count = 0
for i in range(len(s)):
if s[i].isupper():
count+=1
if count != 2:
print('Wa')
exit()
elif s[2:-1].count('C') != 1 or s[0]!='A' or not s[1].islower():
print('Wa')
else:
print('AC')
``` | instruction | 0 | 88,221 | 18 | 176,442 |
No | output | 1 | 88,221 | 18 | 176,443 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA
Submitted Solution:
```
import re
s = input()
print('AC' if s[0].isupper() and (s[2:-2].count('C') == 1 or (s[2:-2] == '' and s[2] == 'C')) and len(re.findall('[a-z]', s)) == len(s) - 2 else 'WA')
``` | instruction | 0 | 88,222 | 18 | 176,444 |
No | output | 1 | 88,222 | 18 | 176,445 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA
Submitted Solution:
```
import sys
str = input()
if str[0] != 'A' :
print("WA")
sys.exit()
str.replace('A', 'a', 1)
flag = False
for i in range(2, len(str) - 1) :
if str[i] == 'C':
str.replace('C' , 'c', 1)
flag = True
if not flag :
print("WA")
sys.exit()
if str.islower():
print("AC")
else:
print("WA")
``` | instruction | 0 | 88,223 | 18 | 176,446 |
No | output | 1 | 88,223 | 18 | 176,447 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).
* All letters except the `A` and `C` mentioned above are lowercase.
Constraints
* 4 β€ |S| β€ 10 (|S| is the length of the string S.)
* Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print `AC`; otherwise, print `WA`.
Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA
Submitted Solution:
```
large=list("BDEFGHIJKLMNOPQRSTUVWXYZ")
small=list("abcdefghijklmnopqrstuvwxyz")
s=list(input())
if s[0]!="A" or s.count("A")!=1:
print("WA")
exit()
t=s[3:len(s)-1]
if t.count("C")!=1:
print("WA")
exit()
for i in s:
if i in large:
print("WA")
exit()
print("AC")
``` | instruction | 0 | 88,224 | 18 | 176,448 |
No | output | 1 | 88,224 | 18 | 176,449 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We just discovered a new data structure in our research group: a suffix three!
It's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which language a sentence is written in.
It's super simple, 100% accurate, and doesn't involve advanced machine learning algorithms.
Let us tell you how it works.
* If a sentence ends with "po" the language is Filipino.
* If a sentence ends with "desu" or "masu" the language is Japanese.
* If a sentence ends with "mnida" the language is Korean.
Given this, we need you to implement a suffix three that can differentiate Filipino, Japanese, and Korean.
Oh, did I say three suffixes? I meant four.
Input
The first line of input contains a single integer t (1 β€ t β€ 30) denoting the number of test cases. The next lines contain descriptions of the test cases.
Each test case consists of a single line containing a single string denoting the sentence. Spaces are represented as underscores (the symbol "_") for ease of reading. The sentence has at least 1 and at most 1000 characters, and consists only of lowercase English letters and underscores. The sentence has no leading or trailing underscores and no two consecutive underscores. It is guaranteed that the sentence ends with one of the four suffixes mentioned above.
Output
For each test case, print a single line containing either "FILIPINO", "JAPANESE", or "KOREAN" (all in uppercase, without quotes), depending on the detected language.
Example
Input
8
kamusta_po
genki_desu
ohayou_gozaimasu
annyeong_hashimnida
hajime_no_ippo
bensamu_no_sentou_houhou_ga_okama_kenpo
ang_halaman_doon_ay_sarisari_singkamasu
si_roy_mustang_ay_namamasu
Output
FILIPINO
JAPANESE
JAPANESE
KOREAN
FILIPINO
FILIPINO
JAPANESE
JAPANESE
Note
The first sentence ends with "po", so it is written in Filipino.
The second and third sentences end with "desu" and "masu", so they are written in Japanese.
The fourth sentence ends with "mnida", so it is written in Korean.
Submitted Solution:
```
def main():
word_count = int(input())
words = []
for i in range(word_count):
words.append(input())
for word in words:
if word[-2:] == 'po':
print('FILIPINO')
elif word[-4:] == 'desu' or word[-4:] == 'masu':
print('JAPANESE')
elif word[-5:] == 'mnida':
print('KOREAN')
else:
print('not possible..')
if __name__ == '__main__':
main()
``` | instruction | 0 | 88,503 | 18 | 177,006 |
Yes | output | 1 | 88,503 | 18 | 177,007 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We just discovered a new data structure in our research group: a suffix three!
It's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which language a sentence is written in.
It's super simple, 100% accurate, and doesn't involve advanced machine learning algorithms.
Let us tell you how it works.
* If a sentence ends with "po" the language is Filipino.
* If a sentence ends with "desu" or "masu" the language is Japanese.
* If a sentence ends with "mnida" the language is Korean.
Given this, we need you to implement a suffix three that can differentiate Filipino, Japanese, and Korean.
Oh, did I say three suffixes? I meant four.
Input
The first line of input contains a single integer t (1 β€ t β€ 30) denoting the number of test cases. The next lines contain descriptions of the test cases.
Each test case consists of a single line containing a single string denoting the sentence. Spaces are represented as underscores (the symbol "_") for ease of reading. The sentence has at least 1 and at most 1000 characters, and consists only of lowercase English letters and underscores. The sentence has no leading or trailing underscores and no two consecutive underscores. It is guaranteed that the sentence ends with one of the four suffixes mentioned above.
Output
For each test case, print a single line containing either "FILIPINO", "JAPANESE", or "KOREAN" (all in uppercase, without quotes), depending on the detected language.
Example
Input
8
kamusta_po
genki_desu
ohayou_gozaimasu
annyeong_hashimnida
hajime_no_ippo
bensamu_no_sentou_houhou_ga_okama_kenpo
ang_halaman_doon_ay_sarisari_singkamasu
si_roy_mustang_ay_namamasu
Output
FILIPINO
JAPANESE
JAPANESE
KOREAN
FILIPINO
FILIPINO
JAPANESE
JAPANESE
Note
The first sentence ends with "po", so it is written in Filipino.
The second and third sentences end with "desu" and "masu", so they are written in Japanese.
The fourth sentence ends with "mnida", so it is written in Korean.
Submitted Solution:
```
n = int(input())
for i in range(n):
s = input()
sz = len(s)
if(sz >= 2 and s[-2:] == "po"):
print("FILIPINO")
elif(sz >= 4 and (s[-4:] == "desu" or s[-4:] == "masu")):
print("JAPANESE")
elif(sz >= 5 and s[-5:] == "mnida"):
print("KOREAN")
``` | instruction | 0 | 88,504 | 18 | 177,008 |
Yes | output | 1 | 88,504 | 18 | 177,009 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We just discovered a new data structure in our research group: a suffix three!
It's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which language a sentence is written in.
It's super simple, 100% accurate, and doesn't involve advanced machine learning algorithms.
Let us tell you how it works.
* If a sentence ends with "po" the language is Filipino.
* If a sentence ends with "desu" or "masu" the language is Japanese.
* If a sentence ends with "mnida" the language is Korean.
Given this, we need you to implement a suffix three that can differentiate Filipino, Japanese, and Korean.
Oh, did I say three suffixes? I meant four.
Input
The first line of input contains a single integer t (1 β€ t β€ 30) denoting the number of test cases. The next lines contain descriptions of the test cases.
Each test case consists of a single line containing a single string denoting the sentence. Spaces are represented as underscores (the symbol "_") for ease of reading. The sentence has at least 1 and at most 1000 characters, and consists only of lowercase English letters and underscores. The sentence has no leading or trailing underscores and no two consecutive underscores. It is guaranteed that the sentence ends with one of the four suffixes mentioned above.
Output
For each test case, print a single line containing either "FILIPINO", "JAPANESE", or "KOREAN" (all in uppercase, without quotes), depending on the detected language.
Example
Input
8
kamusta_po
genki_desu
ohayou_gozaimasu
annyeong_hashimnida
hajime_no_ippo
bensamu_no_sentou_houhou_ga_okama_kenpo
ang_halaman_doon_ay_sarisari_singkamasu
si_roy_mustang_ay_namamasu
Output
FILIPINO
JAPANESE
JAPANESE
KOREAN
FILIPINO
FILIPINO
JAPANESE
JAPANESE
Note
The first sentence ends with "po", so it is written in Filipino.
The second and third sentences end with "desu" and "masu", so they are written in Japanese.
The fourth sentence ends with "mnida", so it is written in Korean.
Submitted Solution:
```
t = int(input())
for i in range(t):
s = input()
if(s[-1] == 'a'):
print("KOREAN")
elif(s[-1] == 'o'):
print("FILIPINO")
else:
print("JAPANESE")
``` | instruction | 0 | 88,505 | 18 | 177,010 |
Yes | output | 1 | 88,505 | 18 | 177,011 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We just discovered a new data structure in our research group: a suffix three!
It's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which language a sentence is written in.
It's super simple, 100% accurate, and doesn't involve advanced machine learning algorithms.
Let us tell you how it works.
* If a sentence ends with "po" the language is Filipino.
* If a sentence ends with "desu" or "masu" the language is Japanese.
* If a sentence ends with "mnida" the language is Korean.
Given this, we need you to implement a suffix three that can differentiate Filipino, Japanese, and Korean.
Oh, did I say three suffixes? I meant four.
Input
The first line of input contains a single integer t (1 β€ t β€ 30) denoting the number of test cases. The next lines contain descriptions of the test cases.
Each test case consists of a single line containing a single string denoting the sentence. Spaces are represented as underscores (the symbol "_") for ease of reading. The sentence has at least 1 and at most 1000 characters, and consists only of lowercase English letters and underscores. The sentence has no leading or trailing underscores and no two consecutive underscores. It is guaranteed that the sentence ends with one of the four suffixes mentioned above.
Output
For each test case, print a single line containing either "FILIPINO", "JAPANESE", or "KOREAN" (all in uppercase, without quotes), depending on the detected language.
Example
Input
8
kamusta_po
genki_desu
ohayou_gozaimasu
annyeong_hashimnida
hajime_no_ippo
bensamu_no_sentou_houhou_ga_okama_kenpo
ang_halaman_doon_ay_sarisari_singkamasu
si_roy_mustang_ay_namamasu
Output
FILIPINO
JAPANESE
JAPANESE
KOREAN
FILIPINO
FILIPINO
JAPANESE
JAPANESE
Note
The first sentence ends with "po", so it is written in Filipino.
The second and third sentences end with "desu" and "masu", so they are written in Japanese.
The fourth sentence ends with "mnida", so it is written in Korean.
Submitted Solution:
```
for i in range(int(input())):
s=input()
n=len(s)
x=s[n-5:n]
if(x=="mnida"):
print("KOREAN")
x=s[n-4:n]
if x=="desu" or x=="masu":
print("JAPANESE")
x=s[n-2:n]
if x=="po":
print("FILIPINO")
``` | instruction | 0 | 88,506 | 18 | 177,012 |
Yes | output | 1 | 88,506 | 18 | 177,013 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We just discovered a new data structure in our research group: a suffix three!
It's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which language a sentence is written in.
It's super simple, 100% accurate, and doesn't involve advanced machine learning algorithms.
Let us tell you how it works.
* If a sentence ends with "po" the language is Filipino.
* If a sentence ends with "desu" or "masu" the language is Japanese.
* If a sentence ends with "mnida" the language is Korean.
Given this, we need you to implement a suffix three that can differentiate Filipino, Japanese, and Korean.
Oh, did I say three suffixes? I meant four.
Input
The first line of input contains a single integer t (1 β€ t β€ 30) denoting the number of test cases. The next lines contain descriptions of the test cases.
Each test case consists of a single line containing a single string denoting the sentence. Spaces are represented as underscores (the symbol "_") for ease of reading. The sentence has at least 1 and at most 1000 characters, and consists only of lowercase English letters and underscores. The sentence has no leading or trailing underscores and no two consecutive underscores. It is guaranteed that the sentence ends with one of the four suffixes mentioned above.
Output
For each test case, print a single line containing either "FILIPINO", "JAPANESE", or "KOREAN" (all in uppercase, without quotes), depending on the detected language.
Example
Input
8
kamusta_po
genki_desu
ohayou_gozaimasu
annyeong_hashimnida
hajime_no_ippo
bensamu_no_sentou_houhou_ga_okama_kenpo
ang_halaman_doon_ay_sarisari_singkamasu
si_roy_mustang_ay_namamasu
Output
FILIPINO
JAPANESE
JAPANESE
KOREAN
FILIPINO
FILIPINO
JAPANESE
JAPANESE
Note
The first sentence ends with "po", so it is written in Filipino.
The second and third sentences end with "desu" and "masu", so they are written in Japanese.
The fourth sentence ends with "mnida", so it is written in Korean.
Submitted Solution:
```
for _ in range(int(input())):
s=input().split('_')
last=s[-1]
if "po" in last:
print("FILIPINO")
elif "masu" in last or "desu" in last:
print("JAPANESE")
elif "mnida" in last:
print("KOREAN")
``` | instruction | 0 | 88,507 | 18 | 177,014 |
No | output | 1 | 88,507 | 18 | 177,015 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We just discovered a new data structure in our research group: a suffix three!
It's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which language a sentence is written in.
It's super simple, 100% accurate, and doesn't involve advanced machine learning algorithms.
Let us tell you how it works.
* If a sentence ends with "po" the language is Filipino.
* If a sentence ends with "desu" or "masu" the language is Japanese.
* If a sentence ends with "mnida" the language is Korean.
Given this, we need you to implement a suffix three that can differentiate Filipino, Japanese, and Korean.
Oh, did I say three suffixes? I meant four.
Input
The first line of input contains a single integer t (1 β€ t β€ 30) denoting the number of test cases. The next lines contain descriptions of the test cases.
Each test case consists of a single line containing a single string denoting the sentence. Spaces are represented as underscores (the symbol "_") for ease of reading. The sentence has at least 1 and at most 1000 characters, and consists only of lowercase English letters and underscores. The sentence has no leading or trailing underscores and no two consecutive underscores. It is guaranteed that the sentence ends with one of the four suffixes mentioned above.
Output
For each test case, print a single line containing either "FILIPINO", "JAPANESE", or "KOREAN" (all in uppercase, without quotes), depending on the detected language.
Example
Input
8
kamusta_po
genki_desu
ohayou_gozaimasu
annyeong_hashimnida
hajime_no_ippo
bensamu_no_sentou_houhou_ga_okama_kenpo
ang_halaman_doon_ay_sarisari_singkamasu
si_roy_mustang_ay_namamasu
Output
FILIPINO
JAPANESE
JAPANESE
KOREAN
FILIPINO
FILIPINO
JAPANESE
JAPANESE
Note
The first sentence ends with "po", so it is written in Filipino.
The second and third sentences end with "desu" and "masu", so they are written in Japanese.
The fourth sentence ends with "mnida", so it is written in Korean.
Submitted Solution:
```
t=int(input())
while(t):
s=input()
x=len(s)
if s[x-2:]=="po":
print("FILIPINO")
elif s[x-4:]=="desu" or s[x-4:]=="masu":
print("JAPNESE")
else:
print("KOREAN")
t=t-1
``` | instruction | 0 | 88,508 | 18 | 177,016 |
No | output | 1 | 88,508 | 18 | 177,017 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We just discovered a new data structure in our research group: a suffix three!
It's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which language a sentence is written in.
It's super simple, 100% accurate, and doesn't involve advanced machine learning algorithms.
Let us tell you how it works.
* If a sentence ends with "po" the language is Filipino.
* If a sentence ends with "desu" or "masu" the language is Japanese.
* If a sentence ends with "mnida" the language is Korean.
Given this, we need you to implement a suffix three that can differentiate Filipino, Japanese, and Korean.
Oh, did I say three suffixes? I meant four.
Input
The first line of input contains a single integer t (1 β€ t β€ 30) denoting the number of test cases. The next lines contain descriptions of the test cases.
Each test case consists of a single line containing a single string denoting the sentence. Spaces are represented as underscores (the symbol "_") for ease of reading. The sentence has at least 1 and at most 1000 characters, and consists only of lowercase English letters and underscores. The sentence has no leading or trailing underscores and no two consecutive underscores. It is guaranteed that the sentence ends with one of the four suffixes mentioned above.
Output
For each test case, print a single line containing either "FILIPINO", "JAPANESE", or "KOREAN" (all in uppercase, without quotes), depending on the detected language.
Example
Input
8
kamusta_po
genki_desu
ohayou_gozaimasu
annyeong_hashimnida
hajime_no_ippo
bensamu_no_sentou_houhou_ga_okama_kenpo
ang_halaman_doon_ay_sarisari_singkamasu
si_roy_mustang_ay_namamasu
Output
FILIPINO
JAPANESE
JAPANESE
KOREAN
FILIPINO
FILIPINO
JAPANESE
JAPANESE
Note
The first sentence ends with "po", so it is written in Filipino.
The second and third sentences end with "desu" and "masu", so they are written in Japanese.
The fourth sentence ends with "mnida", so it is written in Korean.
Submitted Solution:
```
t=int(input())
for _ in range(t):
st=input()
if "po" in st:
print("FILIPINO")
elif "desu" or "masu":
print("JAPANESE")
else:
print("KOREAN")
``` | instruction | 0 | 88,509 | 18 | 177,018 |
No | output | 1 | 88,509 | 18 | 177,019 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We just discovered a new data structure in our research group: a suffix three!
It's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which language a sentence is written in.
It's super simple, 100% accurate, and doesn't involve advanced machine learning algorithms.
Let us tell you how it works.
* If a sentence ends with "po" the language is Filipino.
* If a sentence ends with "desu" or "masu" the language is Japanese.
* If a sentence ends with "mnida" the language is Korean.
Given this, we need you to implement a suffix three that can differentiate Filipino, Japanese, and Korean.
Oh, did I say three suffixes? I meant four.
Input
The first line of input contains a single integer t (1 β€ t β€ 30) denoting the number of test cases. The next lines contain descriptions of the test cases.
Each test case consists of a single line containing a single string denoting the sentence. Spaces are represented as underscores (the symbol "_") for ease of reading. The sentence has at least 1 and at most 1000 characters, and consists only of lowercase English letters and underscores. The sentence has no leading or trailing underscores and no two consecutive underscores. It is guaranteed that the sentence ends with one of the four suffixes mentioned above.
Output
For each test case, print a single line containing either "FILIPINO", "JAPANESE", or "KOREAN" (all in uppercase, without quotes), depending on the detected language.
Example
Input
8
kamusta_po
genki_desu
ohayou_gozaimasu
annyeong_hashimnida
hajime_no_ippo
bensamu_no_sentou_houhou_ga_okama_kenpo
ang_halaman_doon_ay_sarisari_singkamasu
si_roy_mustang_ay_namamasu
Output
FILIPINO
JAPANESE
JAPANESE
KOREAN
FILIPINO
FILIPINO
JAPANESE
JAPANESE
Note
The first sentence ends with "po", so it is written in Filipino.
The second and third sentences end with "desu" and "masu", so they are written in Japanese.
The fourth sentence ends with "mnida", so it is written in Korean.
Submitted Solution:
```
n = int(input())
for i in range(n):
s = input().split("_")[-1]
if s.lower() == "po":
print("FILIPINO")
elif s.lower() == "desu" or s.lower() == "masu":
print("JAPANESE")
elif s.lower() == "mnida":
print("KOREAN")
``` | instruction | 0 | 88,510 | 18 | 177,020 |
No | output | 1 | 88,510 | 18 | 177,021 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given three strings a, b and c of the same length n. The strings consist of lowercase English letters only. The i-th letter of a is a_i, the i-th letter of b is b_i, the i-th letter of c is c_i.
For every i (1 β€ i β€ n) you must swap (i.e. exchange) c_i with either a_i or b_i. So in total you'll perform exactly n swap operations, each of them either c_i β a_i or c_i β b_i (i iterates over all integers between 1 and n, inclusive).
For example, if a is "code", b is "true", and c is "help", you can make c equal to "crue" taking the 1-st and the 4-th letters from a and the others from b. In this way a becomes "hodp" and b becomes "tele".
Is it possible that after these swaps the string a becomes exactly the same as the string b?
Input
The input consists of multiple test cases. The first line contains a single integer t (1 β€ t β€ 100) β the number of test cases. The description of the test cases follows.
The first line of each test case contains a string of lowercase English letters a.
The second line of each test case contains a string of lowercase English letters b.
The third line of each test case contains a string of lowercase English letters c.
It is guaranteed that in each test case these three strings are non-empty and have the same length, which is not exceeding 100.
Output
Print t lines with answers for all test cases. For each test case:
If it is possible to make string a equal to string b print "YES" (without quotes), otherwise print "NO" (without quotes).
You can print either lowercase or uppercase letters in the answers.
Example
Input
4
aaa
bbb
ccc
abc
bca
bca
aabb
bbaa
baba
imi
mii
iim
Output
NO
YES
YES
NO
Note
In the first test case, it is impossible to do the swaps so that string a becomes exactly the same as string b.
In the second test case, you should swap c_i with a_i for all possible i. After the swaps a becomes "bca", b becomes "bca" and c becomes "abc". Here the strings a and b are equal.
In the third test case, you should swap c_1 with a_1, c_2 with b_2, c_3 with b_3 and c_4 with a_4. Then string a becomes "baba", string b becomes "baba" and string c becomes "abab". Here the strings a and b are equal.
In the fourth test case, it is impossible to do the swaps so that string a becomes exactly the same as string b.
Submitted Solution:
```
for i in range(int(input())):
a, b, c = [input() for j in range(3)]
ans = 'yes'
for j in range(len(a)):
if c[j] != a[j] and c[j] != b[j]:
ans = 'no'
break
print(ans)
``` | instruction | 0 | 88,519 | 18 | 177,038 |
Yes | output | 1 | 88,519 | 18 | 177,039 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.