K&R Exercises

Exercise 5-4: Does one string end with another

Write the function strend(s,t), which returns 1 if the string t occurs at the end of the string s, and zero otherwise.

The input is pairs of lines, at most 1000 characters each: s, then t, without their newlines. For each pair, print strend(s,t) on a line of its own. An empty t occurs at the end of any s.

Test Cases

· space→ tab↵ newline

Submissions

No submissions yet