fun main() {
    val s = readLine()!!.trim()

    for (i in 1 until s.length.div(2)) {
        val ss = s.dropLast(i * 2)
        val mid = ss.length.div(2)

        val a = ss.slice(0 until mid)
        val b  = ss.slice(mid .. ss.lastIndex)

        if(a == b){
            print(ss.length)
            return
        }
    }
    print(-1)
}
