プログラミング言語論(2024 年度)テスト解答例(一部)


  1. import Data.Char
    
    main = do all <- getContents
              putStr (unlines (map processLine (lines all)))
    
    processLine ln = let ws = words ln
                         ws2 = map reverse ws
                       in unwords ws2   
    
    
  2. main = do all <- getContents
              putStr (unlines (map processLine (lines all)))
    
    processLine ln = let ws = words ln
                         ws1 = filter (\ word -> length (filter (`elem` "AaIiUuEeOo") word) >= 3) ws
                     in unwords ws1