The Dislex-Wonga test P98345


Statement
 

pdf   zip

html

This year four adventurers went on vacation to Potige, a city in Kerala (India), and they discovered some Indians who speak a strange language called Malayalam. As a language already in development (let’s say, like a beta version), it does not have too many grammatical rules yet.

The main rule is that all words must pass the Dislex-Wonga test. This primitive test consists in painting the letters of the word on a huge wall. Afterwards, two Indians get on a stage, and they start reading (singing) the word, one starting from the beginning and the other one from the end, in opposite directions. The word passes the test if both Indians sing the same song.

Neuquen, the chief of the Potige tribe, imposes adding the necessary letters until the word passes the Dislex-Wonga test, and charges a tax of one rupee on each letter added. Your mission is to help the poor guy who invented the word, so that he pays the least possible money to Neuquen.



Input

Input consists of several words w of length between 1 and 2000, made up only of lowercase letters, uppercase letters, and digits.

Output

For every w, compute the minimum number of necessary characters to add in order to pass the Dislex-Wonga test. If the answer is zero, print “Passes the Dislex-Wonga test”.

Public test cases
  • Input

    neuquen
    MalayAlam
    amoaroma
    amoRoma
    01010111100011100110
    ACGTGTGTGT
    madamImadam
    acasohubobuhosaca
    1
    ablewasiereisawelba
    123nadayosoyadan231
    trlag6e6rl4glud2275ilewleproeg5atieb
    

    Output

    Passes the Dislex-Wonga test
    4
    1
    Passes the Dislex-Wonga test
    3
    3
    Passes the Dislex-Wonga test
    Passes the Dislex-Wonga test
    Passes the Dislex-Wonga test
    Passes the Dislex-Wonga test
    2
    20
    
  • Information
    Author
    Enric S. Cusell
    Language
    English
    Translator
    Salvador Roura
    Original language
    Spanish
    Other languages
    Spanish
    Official solutions
    C++
    User solutions
    C++