module Main where
import Data.List
import Data.Array

int = read::String -> Int
main = interact $ printer . solver . parser

printer = unlines . (:[]) . show
parser = head . lines

solver :: String -> Int
solver s = result
  where
    n = length s
    a = array (0, n-1) (zip [0..] s)

    dp n skip [] = [a!i == a!(i+skip) |i<-[0..(n-skip)]]
    dp n skip prelist = [a!i == a!(i+skip) && p |(i,p)<-zip [0..(n-skip)] (tail prelist)]

    loop (n, step, list) = ((n), (step+2), (dp n step list))
    m1 = length $ filter id $ concat $ map (\(_,_,ls)->ls) $ take n $ iterate loop (n-1, 1, []) 
    m2 = length $ filter id $ concat $ map (\(_,_,ls)->ls) $ take n $ iterate loop (n-1, 2, []) 

    result = (n * (n-1) `div` 2) - (m1+m2) + 1

