Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 18789

Finding Cyclic Shifts Of Strings

$
0
0

I'm a beginner coder and I'm trying to find 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. For example, the cyclic shifts of ABCDE are: ABCDE, BCDEA, CDEAB, DEABC, EABCD. The input will consist of exactly two lines containing only uppercase letters. The first line will bethe text T, and the second line will be the string S.

Output yes if the text, T, contains a cyclic shift of the string, S. Otherwise, output no.

Sample Input:

ABCCDEABAAABCDE

Output for Sample Input:

yes

Viewing all articles
Browse latest Browse all 18789

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>