Jan or Jami

Jan and Jami are playing a game. Initially they have a string (S) consisting of only uppercase letters with fixed length 3. For example, AAH or KSZ or KJH.


This is a companion discussion topic for the original entry at https://toph.co/p/jan-or-jami