From 44afe3c90c7e911ab96c0971db87bafcc12e935f Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 17 Dec 2022 16:20:10 +0200 Subject: [FP/HW3] Solved second exercise, without the file parsing --- Year 2/Functional Programming/hw3.hs | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Year 2/Functional Programming/hw3.hs (limited to 'Year 2/Functional Programming') diff --git a/Year 2/Functional Programming/hw3.hs b/Year 2/Functional Programming/hw3.hs new file mode 100644 index 0000000..432285a --- /dev/null +++ b/Year 2/Functional Programming/hw3.hs @@ -0,0 +1,8 @@ +-- Задача 2 + +countUniques :: String -> Int +countUniques inpt = length (filter (\v -> elem v [2, 3, 4, 7]) (map length (drop 11 (words inpt)))) + +main :: IO() +main = do + print(countUniques "be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe") -- cgit v1.3.1-23-gd82d