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.


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


Sample Output 1


Sample Input 2


Sample Output 2


Sample Input 3


Sample Output 3


Sample Input 4


Sample Output 4



  • 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.