CARVIEW |
Select Language
HTTP/2 200
date: Fri, 10 Oct 2025 20:41:11 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=a7ec761bad9808d806fe14d07a622079e0907609306d269bfd180d2362e8c52da%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22UnSUUnNBGj546wLV-AlL9N-QeGWRqoYj%22%3B%7D; HttpOnly; Path=/
cf-ray: 98c8efe549a1d86d-BLR
Word reorderer (writing) - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- It's an educational app that turns sentences into sets of words and
- -- shuffles the words. Characters that don't make up words, e.g.
- -- punctuation marks, are removed, capital letters are replaced with
- -- their lowercase counterparts. The sentences are read from stdin.
- -- Each sentence should be on a separate line. If a sentence consists
- -- of only one word, the app changes the order of the letters in the
- -- word. The result is written to stdout as sets of comma-separated
- -- words, each set is on a separate line. The order of the shuffled
- -- words isn't random, but its "randomness" is sufficient. A
- -- "sentence" like this "One two three, four five six — seven eight
- -- nine; ten eleven twelve: thirteen fourteen fifteen." will be
- -- changed into the following set of words: "four, eleven, seven,
- -- twelve, two, thirteen, eight, fourteen, one, fifteen, nine, five,
- -- ten, six, three".
- import Data.List (intercalate, sort)
- import Data.Char (toLower)
- import System.Exit (die)
- main :: IO ()
- main = do
- input <- getContents
- if null input
- then die "No input given!"
- else mapM_ putStrLn $
- listsOfWordsToLines $
- map
- ((shuffleList . processSingleWords) . words)
- (lines $ proccessChars input)
- processChars :: String -> String
- processChars [] = []
- processChars string =
- filter (`elem` "abcdefghijklmnopqrstuvwxyz’'- \n") $ map toLower string
- processSingleWords :: [String] -> [String]
- processSingleWords [] = []
- processSingleWords [x]
- | x == sort x = [reverse x]
- | otherwise = [sort x]
- processSingleWords x = x
- increasingChunks :: [String] -> [[String]]
- increasingChunks [] = []
- increasingChunks list = aux 1 list
- where
- aux _ [] = []
- aux n lst = take n lst : aux (n + 1) (drop n lst)
- interlaceLists :: [String] -> [String] -> [String]
- interlaceLists x [] = x
- interlaceLists [] x = x
- interlaceLists listOne@(x:xs) listTwo@(y:ys)
- | length listOne > length listTwo = x : y : interlaceLists xs ys
- | otherwise = y : x : interlaceLists ys xs
- shuffleList :: [String] -> [String]
- shuffleList [] = []
- shuffleList list = foldl1 interlaceLists $ increasingChunks list
- listsOfWordsToLines :: [[String]] -> [String]
- listsOfWordsToLines [[]] = []
- listsOfWordsToLines list = map (intercalate ", ") list
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐⭐Exchange Exploit⭐⭐ Y
JavaScript | 2 sec ago | 0.24 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ C
JavaScript | 6 sec ago | 0.24 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ K
JavaScript | 17 sec ago | 0.24 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ 4
JavaScript | 26 sec ago | 0.24 KB
-
⭐✅ Swapzone Glitch ✅ Working⭐⭐⭐ F
JavaScript | 28 sec ago | 0.24 KB
-
⭐✅ Swapzone Glitch ✅ Working⭐⭐⭐ R
JavaScript | 38 sec ago | 0.24 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ 7
JavaScript | 39 sec ago | 0.24 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ B
JavaScript | 49 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand