func :: String -> [String] -> Int
func s days | days == ["SUN"] = 0
            | s == head days = 1 + func (head (tail days)) (tail days)
            | otherwise = 0 + func s (tail days)
         
main :: IO()
main = do
  s <- getLine
  putStrLn $ show (func s a)
  where a = ["SUN","MON","TUE","WED","THU","FRI","SAT","SUN"]