Woburn Challenge 2017-18 Round 1 - Junior Division
Nice, you've just landed your first software engineering internship at a popular blog site! Your first task is to collect data about which countries all of the site's bloggers live in, for further analysis.
Now, you don't exactly have the most experience with such things, but it's important that you get it done somehow. Asking for help would make you look weak! As a first step, it shouldn't be too hard to figure out whether or not a given user is Canadian, right?
You've already gotten a script together to load the text from a single blog post and strip it down into a more convenient format - a non-empty string consisting of at most lowercase letters.
Unfortunately, from there, your algorithm is questionable at best. You
know that a characteristic of words written by Canadians is that they
sometimes end in our
rather an or
. However, due to faulty
programming, your script will decide that the blogger is Canadian if
their text contains at least one instance of the subsequence our
.
A string subsequence is an ordered but possibly non-consecutive set of
characters in it. For example, the string abac
contains subsequences
ab
, ac
, bc
, and abc
, among others. However, it does not
contain the subsequence ca
, as an a
never appears anywhere after
a c
.
Things aren't looking great for your internship, but might as well at
least test out your approach. Given a string , output Y
if your
script would determine that the blogger is Canadian, or N
otherwise.
Subtasks
In test cases worth of the points, contains at most letters.
Input Specification
The first and only line of input consists of a single string, .
Output Specification
Output a single character, either Y
if the blogger is identified as
a Canadian, or N
otherwise.
Sample Input 1
colorusedtobemyfavoriteword
Sample Output 1
Y
Sample Input 2
torontousedtobemytowneh
Sample Output 2
N
Sample Explanation
In the first case, though the blogger doesn't seem very Canadian, the
subsequence our
is present at least once in . One instance of it is
indicated below:
col[o]r[u]sedtobemyfavoritewo[r]d
In the second case, though the blogger is clearly Canadian and does
contain the subsequence rou
, it does not contain the subsequence
our
.
Comments
someone explain to me why i am failing case 6 in batch 3?
Your code is wrong; consider the input
If you want more debugging help, you are encouraged to join the DMOJ Discord.
Oh thx, I was choosing the first instance of the characters.