Question: Write a program called contains that takes two text strings as arguments and prints true followed by a newline if the second string is entirely

Write a program called "contains" that takes two text strings as arguments and prints "true" followed by a newline if the second string is entirely contained within the first, or "false" followed by a newline otherwise.

The strings contain only ASCII characters and may be any length > 0 characters. Strings in argv are always null-terminated.

Write a program called "contains" that takes two text strings as arguments

Write a program called "contains" that takes two text strings as arguments and prints "true" followed by a newline if the second string is entirely contained within the first, or "false" followed by a newline otherwise the strings contain only ASCII characters and may be any length > 0 characters. Strings in rag are always null-terminated This is an important problem in computer science, with wide applications from searching the internet, to understanding text, to finding DNA matches. It's easy to state and easy to code. It gets interesting when the strings are long and you want to do it very efficiently. For now, you can be happy with a simple solution to practice managing rag array and char strings. Example runs: $ ./contains "I have a really bad feeling about this" "bad feeling" true $ ./contains "To be or not to be" "That is the question" false $ ./contains "I am the walrus" "I am the walrus" true $ ./contains "the walrus" "I am the walrus" false $ ./contains "kmjnhbvc45&A$bn" "." false Notice that the strings do not have quote characters around them when delivered to your program via rag. The quotes prevent the shell from breaking the strings up into individual words. You may find the standard library function stolen () useful Read its manage

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!