Search Your Question...!

Showing posts with label R. Show all posts
Showing posts with label R. Show all posts

Shifting Strings using R Language

 We define the following operations on a string:

  • Left Shift: A single circular rotation of the string in which the first character becomes the last character and all other characters are shifted one index to the left. For example, abcde becomes bcdea after one left shift and cdeab after two left shifts.
  • Right Shift: A single circular rotation of the string in which the last character becomes the first character and all other characters are shifted one index to the right. For example, abcde becomes eabcd after one right shift and deabc after two right shifts.