LCC '18 Contest 2 J3 - Wrong Dere(c)k!

View as PDF

Submit solution

Points: 7
Time limit: 1.5s
Memory limit: 64M

Problem type

Dereck is an avid Java programmer while Derek is a C++ programmer. Whenever someone asks them for help, they tend to mix up their names, frustrating them as they don't know any other languages other than the ones they program in. Being the good friend you are, you decide to intervene and tell people whether they have mixed up their names or not.

  • A statement about C++ is defined as a sentence that contains the word segmentation and/or fault.
  • A statement about Java is defined as a sentence that contains the word biginteger and/or apics (pronounced as AP ICS).
  • You will know when the person is asking Dereck or Derek if the sentence has a permutation of his name.
  • You are guaranteed that the sentence will either be a Java or C++ statement and not both.
  • You are guaranteed that the sentence will either ask for Dereck or Derek and not both.


  • e is interchangeable with 3
  • s is interchangeable with 5
  • a is interchangeable with @
  • t is interchangeable with 7
  • i is interchangeable with 1

Given a sentence, \(S\), from Jason, the person who's asking Dere(c)k for help, can you politely tell them whether they're asking the wrong or right Dere(c)k?

Input Specification

The first line will contain a string, \(S\), with at most \(100\ 000\) characters, with all letters being lower-case.

Output Specification

If \(S\) was a Java statement towards Dereck or a C++ statement towards Derek, output Right Dere(c)k!. If it wasn't then output Wrong Dere(c)k!.


Subtask 1 [15%]

\(S\) will contain at most \(100\) lower-case characters.

Subtask 2 [85%]

No further constraints.

Sample Input

hey dcr3ek, can you help me with my homework? i dont really understand b1g1nteger :p

Sample Output

Right Dere(c)k!


dcr3ek can be rearranged as d3reck and since e is interchangeable with 3, d3reck becomes dereck. Following the last step, b1g1nteger becomes biginteger since i is interchangeable with 1. This makes the sentence a Java sentence that asks Dereck for help, so the output is Right Dere(c)k!


There are no comments at the moment.