// Version of the file reading program that
// repeatedly appends to a StringBuilder.
// (Fast)
import java.io.*;

class StringReaderB {
    StringBuilder stringBuilder = new StringBuilder();
    
    public void append(char c) {
        stringBuilder.append(c);
    }

    public String toString() {
        return stringBuilder.toString();
    }
}

public class CopyStringBuilder {
    public static void main(String[] args) {
        StringReaderB reader = new StringReaderB();
        
        try {
            int i = 0;

            // Read in characters one at a time.
            Character c = readChar();
            while (c != null) {
                reader.append(c);
                c = readChar();

                i++;
                if (i % 1000 == 0)
                    System.out.println("Read " + i + " characters");
            }

            System.out.print(reader);
            System.out.print(reader);
        } catch (IOException e) {
            System.err.println(e);
        }
    }

    static InputStreamReader in = new InputStreamReader(System.in);
    // Read one character from System.in, or return null on end-of-file.
    static Character readChar() throws IOException {
        int c = in.read();
        if (c == -1)
            return null;
        else
            return (char)c;
    }
}