#P6739. Recover Original String

    ID: 19947 Type: Default 1000ms 256MiB

Recover Original String

Recover Original String

You are given a string \( U \) which is obtained by performing the following operations on an unknown string \( S \):

  1. Duplicate \( S \) to form \( T = S+S \).
  2. Insert a single extra character at an arbitrary position into \( T \) to produce \( U \).

Your task is to determine the original string \( S \) given \( U \). Note that the length of \( U \) is \( 2|S|+1 \).

inputFormat

The input consists of a single line containing the string \( U \). It is guaranteed that \( U \) has a length of \( 2|S|+1 \) for some non-empty string \( S \).

outputFormat

Output the original string \( S \>.

sample

acbab
ab