Sort by

recency

|

17 Discussions

|

  • + 0 comments

    Simply needed to say I truly can't stand Haskell. Took me two months to sort out some way to understand strings and work with them electric hedge trimmers..

  • + 0 comments

    f# solution

    open System
    
    Console.ReadLine()
    |> Seq.toList
    |> List.distinct
    |> Seq.map string
    |> String.concat ""
    |> Console.WriteLine
    
  • + 0 comments

    Elixir solution:

    defmodule Solution do
        def dedupe(input) do
            String.codepoints(input)
            |> Enum.reduce("", fn x, acc ->
                if String.contains?(acc, x) do
                    acc
                else  
                    acc <> x
                end
            end)
        end
    end
    
    input = IO.read(:stdio, :all)
    
    Solution.dedupe(input)
    |>IO.puts
    
  • + 0 comments

    how to write code in c++ in this ?

  • + 0 comments
    removeDuplicates :: String -> String
    removeDuplicates string = foldl (\acc char -> if char `elem` acc then acc else acc ++ [char]) [] string
    
    main = do
        line <- getLine
        putStr $ removeDuplicates line