| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 14 | 8 | 6 | 50.000% |
Computers are playing a game to become a millionaire. Each computer is given 1 euro to begin with and gets 20 questions. If a question contains a palindromic subsequence of 4 or more characters, the amount of money is doubled and then the length of the longest palindromic subsequence is added to it, otherwise the amount of money remains the same.
A palindrome is a string that remains the same when reversed, for example "anna". Palindromes can be formed by joining neighboring words, for example "\ldots and name \ldots" contains the palindromic subsequence "andna". Palindromes may also wrap from the end of the question to the beginning, for example "Jane went walking with Jelena" contains the palindromic subsequence "enajane" and "Matti is I ttam" contains the palindromic subsequence "ittammatti".
When looking for palindromes, comparison of letters should be case-insensitive. Spaces and line breaks should be ignored, but other punctuation does matter.
Write a program that reads the list of questions and outputs the final amount of money.
The input will have exactly 20 paragraphs containing only ASCII characters. Each paragraph is separated from the next by an empty line. A paragraph can contain at most 600 characters.
The first and only line of output should contain the final amount of money that is won.
anna title and name of the author Jane went walking with Jelena Matti is I ttam lorem ipsum Matti is I'ttam. Jane went walking with Jelena Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
393
The first four questions are the examples from the above. So, score goes from the initial $1$ to $2 \cdot 1 + 4 = 6$, then to $2 \cdot 6 + 5 = 17$, then to $2 \cdot 17 + 7 = 41$ and then to $2 \cdot 41 + 10 = 92$. The fifth question does not contain a palindrome, so the score does not change. The sixth question contains the palindrome "ttam.matt", so the score increases to $2 \cdot 92 + 9 = 193$. The seventh question is the same as the third, only split across three lines, so the score grows to $2 \cdot 193 + 7 = 393$. The remaining questions (which are too long to print here, please look at the electronic copy of the input file available from the contest server) do not contain palindromes, so $393$ is the final score in this game.