Computer Science: An Overview: Global Edition (12th Edition)

Published by Pearson Higher Education
ISBN 10: 1292061162
ISBN 13: 978-1-29206-116-0

Chapter 5 - Algorithms - Chapter Review Problems - Page 265: 21

Answer

s1 = take input s2 = take input n=length(s2) if n != length(s2): print("Given strings are not equal") End program i=0 while(i<=n) if s1[i]!=s2[i] return False else i=i+1 return True

Work Step by Step

The above program first checks the length of both strings and then matches character at every index of both string if they are all same then the program concludes that the given strings are equal.
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.