import qualified Data.List as L

main :: IO ()
main = print . solve =<< getLine

solve :: String -> Int
solve = length . L.nub . possibleStrings
    where
        possibleStrings :: String -> [String]
        possibleStrings s = l ++ r
            where
                l = possibleStrings' (tail s) [[head s]]
                r = possibleStrings' (init s) [[last s]]

                possibleStrings' :: String -> [String] -> [String]
                possibleStrings' [] x = x
                possibleStrings' t x = l' ++ r'
                    where
                        l' = possibleStrings' (tail t) (map (\y -> head t:y) x)
                        r' = possibleStrings' (init t) (map (\y -> last t:y) x)