Sabihah likes finding cyclic shifts of strings. A cyclic shift of a string is obtained by moving characters from the beginning of the string to the end of the string. We also consider a string to be a...



Sabihah likes finding cyclic shifts of strings. A cyclic shift of a string is obtained by moving characters from the beginning of the string to the end of the string. We also consider a string to be a cyclic shift of itself. For example, the cyclic shifts of ABCDE are: ABCDE, BCDEA, CDEAB, DEABC, and EABCD.


Design a Python program called "cyclicshift_firstname_lastname" that takes 2 words from the user. Your program must display "YES" if the first word contains a cyclic shift of the second word, other wise "NO".


Sample Input/outputs:
Enter a word: ABCCDEABAA
Enter a 2nd word: ABCDE
Your App must display "YES".


Explanation:
CDEAB is a cyclic shift of ABCDE and it is contained in the text ABCCDEABAA.




Enter a word: ABCDDEBCAB
Enter a 2nd word: ABA
Your App must display "NO".


Explanation:
The cyclic shifts of ABA are ABA, BAA, and AAB. N1 of these shifts are contained in the text
ABCDDEBCAB



Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here