Mock CCC '18 Contest 1 J2 - A Substring Problem

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 2.0s
Memory limit: 1G

Problem type

A string is a palindrome if and only if it reads the same forwards and backwards.

A substring of a string s is a nonempty sequence of consecutive characters from s.

Define a string to be odd if and only if all substrings of the string that are palindromes have odd length.

Given a string s, determine if it is odd.

Constraints

1 \le |S| \le 100

S will only contain lowercase ASCII letters.

Input Specification

The input consists of a single line containing the string s.

Output Specification

Print on a single line, if the string is odd, Odd; if not, Even.

Sample Input 1

amanaplanacanalpanama

Sample Output 1

Odd

Sample Input 2

madamimadam

Sample Output 2

Odd

Sample Input 3

annamyfriend

Sample Output 3

Even

Sample Input 4

nopalindromes

Sample Output 4

Odd

Comments


  • 0
    Xiang_li  commented on Feb. 8, 2022, 2:53 a.m.

    just looked at the top solution and realized I am stupid.


  • 2
    Jeffmagma  commented on Aug. 27, 2018, 2:48 a.m.

    for some reason you need to end your answers with a newline to pass? it does say

    Print on a single line, if the string...

    so idk


    • 2
      Ninjaclasher  commented on Aug. 27, 2018, 3:29 a.m.

      This happens to be a xiaowuc1 problem, which uses an identical checker. Standard convention uses a newline at the end of input, which is how the test data is formatted.


  • 16
    Mr_Lim  commented on Feb. 15, 2018, 2:30 p.m.

    To my younger students struggling with this question because you are attempting to check if every single substring is a palindrone, and then determining whether it has an even or odd length: I appreciate your tenacity.

    There is a reason this is only a 3 point question and is considered "J2 level" as there is a simpler approach which may not be obvious to many of you. After fighting with this problem for a reasonable time, please click on the "Read editorial" link on the right, and read the message from the author for a hint.