Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

42%
+1 −2
Q&A How to efficiently remove every occurrence of one string inside another

I've accidentally disabled my account hence I'm answering the questions that I've answered before again. Adding on to this, I feel like adding a comment, please do bear in mind that this code isn't...

posted 2y ago by VincentLeonarX‭  ·  edited 2y ago by VincentLeonarX‭

Answer
#6: Post edited by user avatar VincentLeonarX‭ · 2022-06-26T14:15:24Z (almost 2 years ago)
  • I accidentally **disabled** my account hence I'm answering the questions that I've answered before again. Adding on to this, I feel like adding a comment, please do bear in mind that this code isn't necessarily working.
  • Solution:
  • ```
  • myProgram = do {
  • putStrLn "Enter three sides: ";
  • str<-getLine;
  • putStr "RightAngle: ";
  • print (snd(head (classify (head (strtok str)) (strtok str!!1) (strtok str!!2))));
  • putStr "Isosceles: ";
  • print (snd (classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!1));
  • putStr "Equilateral: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!2));
  • putStr "Scalene: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!3));
  • putStr "End"}```
  • I've accidentally **disabled** my account hence I'm answering the questions that I've answered before again. Adding on to this, I feel like adding a comment, please do bear in mind that this code isn't necessarily working.
  • Solution:
  • ```
  • myProgram = do {
  • putStrLn "Enter three sides: ";
  • str<-getLine;
  • putStr "RightAngle: ";
  • print (snd(head (classify (head (strtok str)) (strtok str!!1) (strtok str!!2))));
  • putStr "Isosceles: ";
  • print (snd (classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!1));
  • putStr "Equilateral: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!2));
  • putStr "Scalene: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!3));
  • putStr "End"}```
#5: Post edited by user avatar VincentLeonarX‭ · 2022-06-26T14:14:49Z (almost 2 years ago)
  • Solution:
  • ```
  • myProgram = do {
  • putStrLn "Enter three sides: ";
  • str<-getLine;
  • putStr "RightAngle: ";
  • print (snd(head (classify (head (strtok str)) (strtok str!!1) (strtok str!!2))));
  • putStr "Isosceles: ";
  • print (snd (classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!1));
  • putStr "Equilateral: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!2));
  • putStr "Scalene: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!3));
  • putStr "End"}```
  • I accidentally disabled my account hence I'm answering the questions that I've answered before again. Adding on to this, I feel like adding a comment, please do bear in mind that this code isn't necessarily working.
  • I accidentally **disabled** my account hence I'm answering the questions that I've answered before again. Adding on to this, I feel like adding a comment, please do bear in mind that this code isn't necessarily working.
  • Solution:
  • ```
  • myProgram = do {
  • putStrLn "Enter three sides: ";
  • str<-getLine;
  • putStr "RightAngle: ";
  • print (snd(head (classify (head (strtok str)) (strtok str!!1) (strtok str!!2))));
  • putStr "Isosceles: ";
  • print (snd (classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!1));
  • putStr "Equilateral: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!2));
  • putStr "Scalene: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!3));
  • putStr "End"}```
#4: Post edited by user avatar VincentLeonarX‭ · 2022-06-26T14:13:24Z (almost 2 years ago)
  • Solution:
  • ```
  • myProgram = do {
  • putStrLn "Enter three sides: ";
  • str<-getLine;
  • putStr "RightAngle: ";
  • print (snd(head (classify (head (strtok str)) (strtok str!!1) (strtok str!!2))));
  • putStr "Isosceles: ";
  • print (snd (classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!1));
  • putStr "Equilateral: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!2));
  • putStr "Scalene: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!3));
  • putStr "End"}```
  • I feel like adding a comment, please do bear in mind that this code isn't necessarily working. You need to try it on your own.
  • Solution:
  • ```
  • myProgram = do {
  • putStrLn "Enter three sides: ";
  • str<-getLine;
  • putStr "RightAngle: ";
  • print (snd(head (classify (head (strtok str)) (strtok str!!1) (strtok str!!2))));
  • putStr "Isosceles: ";
  • print (snd (classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!1));
  • putStr "Equilateral: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!2));
  • putStr "Scalene: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!3));
  • putStr "End"}```
  • I accidentally disabled my account hence I'm answering the questions that I've answered before again. Adding on to this, I feel like adding a comment, please do bear in mind that this code isn't necessarily working.
#3: Post edited by user avatar VincentLeonarX‭ · 2022-06-26T14:11:53Z (almost 2 years ago)
  • Solution:
  • ```
  • myProgram = do {
  • putStrLn "Enter three sides: ";
  • str<-getLine;
  • putStr "RightAngle: ";
  • print (snd(head (classify (head (strtok str)) (strtok str!!1) (strtok str!!2))));
  • putStr "Isosceles: ";
  • print (snd (classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!1));
  • putStr "Equilateral: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!2));
  • putStr "Scalene: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!3));
  • putStr "End"}```
  • Solution:
  • ```
  • myProgram = do {
  • putStrLn "Enter three sides: ";
  • str<-getLine;
  • putStr "RightAngle: ";
  • print (snd(head (classify (head (strtok str)) (strtok str!!1) (strtok str!!2))));
  • putStr "Isosceles: ";
  • print (snd (classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!1));
  • putStr "Equilateral: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!2));
  • putStr "Scalene: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!3));
  • putStr "End"}```
  • I feel like adding a comment, please do bear in mind that this code isn't necessarily working. You need to try it on your own.
#2: Post edited by user avatar VincentLeonarX‭ · 2022-06-26T14:03:37Z (almost 2 years ago)
  • Solution:
  • ```
  • myProgram = do {
  • putStrLn "Enter three sides: ";
  • str<-getLine;
  • putStr "RightAngle: ";
  • print (snd(head (classify (head (strtok str)) (strtok str!!1) (strtok str!!2))));
  • putStr "Isosceles: ";
  • print (snd (classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!1));
  • putStr "Equilateral: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!2));
  • putStr "Scalene: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!3));
  • putStr "End"}```
  • Solution:
  • ```
  • myProgram = do {
  • putStrLn "Enter three sides: ";
  • str<-getLine;
  • putStr "RightAngle: ";
  • print (snd(head (classify (head (strtok str)) (strtok str!!1) (strtok str!!2))));
  • putStr "Isosceles: ";
  • print (snd (classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!1));
  • putStr "Equilateral: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!2));
  • putStr "Scalene: ";
  • print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!3));
  • putStr "End"}```
#1: Initial revision by user avatar VincentLeonarX‭ · 2022-06-26T14:02:56Z (almost 2 years ago)
Solution:


 ```
myProgram = do {
    putStrLn "Enter three sides: ";
    str<-getLine;
    putStr "RightAngle: ";
    print (snd(head (classify (head (strtok str)) (strtok str!!1) (strtok str!!2))));
    putStr "Isosceles: ";
    print (snd (classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!1));
    putStr "Equilateral: ";
    print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!2));
    putStr "Scalene: ";
    print (snd(classify (head (strtok str)) (strtok str!!1) (strtok str!!2)!!3));
    putStr "End"}```