Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:qwertyuiopasdfghjkl;zxcvbnm,./Unfortunately Mole is blind, so sometimes it is problem for him to put his hands accurately. He accidentally moved both his hands with one position to the left or to the right. That means that now he presses not a button he wants, but one neighboring button (left or right, as specified in input).We have a sequence of characters he has typed and we want to find the original message.

First line of the input contains one letter describing direction of shifting ('L' or 'R' respectively for left or right). Second line contains a sequence of characters written by Mole. The size of this sequence will be no more than 100. Sequence contains only symbols that appear on Mole's keyboard. It doesn't contain spaces as there is no space on Mole's keyboard. It is guaranteed that even though Mole hands are moved, he is still pressing buttons on keyboard and not hitting outside it.

Print a line that contains the original message.

import java.io.*
import java.util.*

class ProblemIO(val rd: BufferedReader, val wr: PrintWriter) {
    companion object {
        fun console() = ProblemIO(BufferedReader(InputStreamReader(System.`in`)), PrintWriter(System.out))
    }

    var tok = StringTokenizer("")

    fun close() { rd.close(); wr.close() }
    fun <T> print(v: T) = wr.print(v)
    fun <T> println(v: T) = wr.println(v)
    fun readToken(): String {
        while (!tok.hasMoreTokens()) tok = StringTokenizer(rd.readLine())
        return tok.nextToken()
    }
    fun readInt() = readToken().toInt()
    fun readLong() = readToken().toLong()
    fun readLine() : String {
        tok = StringTokenizer("")
        return rd.readLine()
    }
}

fun main(args: Array<String>) {
    Thread({ val io = ProblemIO.console(); solve(io) ; io.close() }).start()
}

fun solve(io: ProblemIO) {
    val kbd = arrayOf("qwertyuiop", "asdfghjkl;", "zxcvbnm,./")
    val lm = HashMap<Char, Char>()
    val rm = HashMap<Char, Char>()
    for (s in kbd) {
        for (i in s.indices) {
            if (i > 0) lm[s[i]] = s[i - 1]
            if (i < s.lastIndex) rm[s[i]] = s[i + 1]
        }
    }
    val d = io.readToken()
    val m = if (d == "L") rm else lm
    val s = io.readToken()
    io.println(s.map({ ch -> m[ch] }).joinToString(""))
}

fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    //val len = r.readLine()!!.toInt()
    //val (n, m) = r.readLine()!!.split(" ").map { it.toInt() }
    val type = r.readLine()!!
    val str = "qwertyuiopasdfghjkl;zxcvbnm,./".split("").filter { it.length > 0 }
    val before = r.readLine()!!
    before.forEach {
        var i = str.indexOf(it.toString())
        if (type=="R") i--
        else i++
        s.append(str[i])
    }
    println(s)
}

import java.lang.StringBuilder

private const val layout = "qwertyuiopasdfghjkl;zxcvbnm,./"

fun main(args: Array<String>) {
    val direction = readLine()!!
    val message = readLine()!!
    val correction = if (direction == "L") 1 else -1
    val result = StringBuilder()
    for (char in message) {
        val currentIndex = layout.indexOf(char)
        val requiredCharIndex = currentIndex + correction
        val requiredChar = layout[requiredCharIndex]
        result.append(requiredChar)
    }
    print(result)
}

fun main() = Pair(readLine()!! == "R", readLine()!!)
    .let { (rightShifted, wrongMessage) ->
        val shiftedKeysMap = hashMapOf<Char, Pair<Char, Char>>().apply {
            "qwertyuiopasdfghjkl;zxcvbnm,./".let { keyboard ->
                keyboard.forEachIndexed { index, key ->
                    put(
                        key,
                        Pair(keyboard.getOrNull(index - 1) ?: '*', keyboard.getOrNull(index + 1) ?: '*')
                    )
                }
            }
        }
        wrongMessage
            .map { key -> shiftedKeysMap[key]!!.run { if (rightShifted) first else second } }
            .joinToString("")
    }
    .run(::println)

fun main() {
    val shift = readLine()!!
    val output = readLine()!!.map { getLetter(shift, it) }.joinToString("")
    println(output)
}

fun getLetter(shift: String, char: Char): Char {
    val line = listOf(
        "qwertyuiop",
        "asdfghjkl;",
        "zxcvbnm,./"
    ).first { it.contains(char) }

    val position = line.indexOf(char)
    val shiftIndex = if (shift == "L") 1 else -1
    return line.get(position + shiftIndex)
}

fun main()
{
    val abc="qwertyuiopasdfghjkl;zxcvbnm,./"
    var dir = readLine().toString()
    var text = readLine().toString()
    val t = text.toCharArray()
    for(index in 0..text.length-1)
    {
        if (dir == "R") {
            val eindex: Int = abc.indexOf(t[index]) - 1
            t[index] = abc[eindex]

        } else {
            val eindex: Int = abc.indexOf(t[index]) + 1
            t[index] = abc[eindex]
        }

    }
      text = String(t)
    println(text)
}

import java.io.BufferedReader
import java.io.InputStreamReader
import java.lang.StringBuilder

fun main() {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val shifting = br.readLine()
    val s = br.readLine()
    val keys = ("qwertyuiop" + "asdfghjkl;" + "zxcvbnm,./").toList()
    val keysIndices = keys.zip(keys.indices).toMap()
    println(
        s.fold(StringBuilder()){acc, c ->
            acc.apply {
                append(
                    if (shifting == "R") keys[keysIndices[c]!! - 1]
                    else keys[keysIndices[c]!! + 1]
                )
            }
        }
    )
}

import java.math.BigInteger

fun main() {
    var direction = readLine()!!
    var str = readLine()!!
    var ansStr = "qwertyuiopasdfghjkl;zxcvbnm,./"
    var ans =""
    if (direction=="R"){
        for (i in str){
            var j = 1
            while (j<ansStr.length){
                if (i==ansStr[j]){
                    ans+=ansStr[j-1]
                    break
                }
                j++

            }
        }
    }else{
        for (i in str){
            var j = 0
            while (j<ansStr.length){
                if (i==ansStr[j]){
                    ans+=ansStr[j+1]
                    break
                }
                j++

            }
        }
    }
    println(ans)
}

fun main(args: Array<String>) {
    val keyboard = "qwertyuiopasdfghjkl;zxcvbnm,./"
    val dir = if (readLine()!! == "R") -1 else 1
    val input = readLine()!!
    println(String(input.map { it -> keyboard[keyboard.indexOf(it) + dir] }.toCharArray()))
}

fun main(args:Array<String>) {
    val a="qwertyuiopasdfghjkl;zxcvbnm,./"
    val LR= readLine()!!
    var x= readLine()!!
    var result=""
    var f=1
    if(LR=="R")
        f*=-1
    for(i in 0 until x.length){
      result+=a[a.indexOf(x[i])+f]
    }
    println(result)
}

import java.lang.AssertionError
import java.util.*

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

private fun myAssert(x: Boolean) {
    if (!x) {
        throw AssertionError()
    }
}

fun main(args: Array<String>) {
//  var s = Scanner(System.`in`)
  var cmd = readLn()
  var line = readLn()
  var map = mutableMapOf<Char, Char>()
  var keyboard = "qwertyuiopasdfghjkl;zxcvbnm,./"
  if (cmd == "R") {
    for (i in 1..keyboard.length - 1) {
      map[keyboard[i]] = keyboard[i - 1]
    }
    for (i in 0..line.length - 1) {
      print("${map[line[i]]}")
    }
    print("\n")
  } else {
    for (i in 0..keyboard.length - 2) {
      map[keyboard[i]] = keyboard[i + 1]
    }
    for (i in 0..line.length - 1) {
      print("${map[line[i]]}")
    }
    print("\n")
  }
}

fun main() {
    val shift = if (readLine()!! == "R") -1 else 1
    val text = readLine()!!
    val map = mutableMapOf<Char, Pair<Int, Int>>()
    val lines = arrayOf("qwertyuiop", "asdfghjkl;", "zxcvbnm,./")
    for (linePos in 0 until 3)
        for ((charPos, char) in lines[linePos].withIndex())
            map[char] = linePos to charPos
    val sb = StringBuilder()
    for (c in text) {
        val (linePos, charPos) = map[c]!!
        sb.append(lines[linePos][charPos + shift])
    }
    print(sb.toString())
}

import java.util.TreeMap

interface LexicographicComparable<T> : Comparable<T> {
  fun num_fields() : Int
  fun compare_field(i : Int, other : T) : Int

  override fun compareTo(other : T) : Int {
    val n = num_fields()
    for (i in 0 .. (n - 1)) {
      val c = compare_field(i, other)
      if (c == 0) {
        // Do nothing ...
      } else {
        return c
      }
    }
    return 0
  }
}

class KeyboardCharacter : LexicographicComparable<KeyboardCharacter> {
  val row : Int
  val index : Int

  constructor(row : Int, index : Int) {
    this.row = row
    this.index = index
  }

  fun neighbor(l_or_r : String) : KeyboardCharacter {
    when (l_or_r) {
      "L" -> return KeyboardCharacter(this.row, this.index + 1)
      "R" -> return KeyboardCharacter(this.row, this.index - 1)
      else -> throw Exception("Unknown neighbor.")
    }
  }

  override fun num_fields() : Int {
    return 2
  }

  override fun compare_field(i : Int, other : KeyboardCharacter) : Int {
    when (i) {
      0 -> return this.row.compareTo(other.row)
      1 -> return this.index.compareTo(other.index)
      else -> throw Exception("Invalid field!")
    }
  }

  override fun toString() : String {
    return "(${this.row}, ${this.index})"
  }
}

fun updateKeyboard(row : Int,
                   keys : String,
                   kbToChar : TreeMap<KeyboardCharacter, Char>,
                   charToKb : TreeMap<Char, KeyboardCharacter>) {
  var index = 0
  for (char in keys) {
    val kb = KeyboardCharacter(row, index)
    kbToChar.put(kb, char)
    charToKb.put(char, kb)
    index = index + 1
  }
}

fun readString() : String {
  val str_nullable = readLine()
  if (str_nullable == null) {
    throw Exception("Could not read string!")
  } else {
    val str = str_nullable
    return str
  }
}

fun main(args : Array<String>) {
  val row_0 = "qwertyuiop"
  val row_1 = "asdfghjkl;"
  val row_2 = "zxcvbnm,./"
  val kbToChar = TreeMap<KeyboardCharacter, Char>()
  val charToKb = TreeMap<Char, KeyboardCharacter>()
  updateKeyboard(0, row_0, kbToChar, charToKb)
  updateKeyboard(1, row_1, kbToChar, charToKb)
  updateKeyboard(2, row_2, kbToChar, charToKb)
  // println("${kbToChar}")
  // println("${charToKb}")
  val l_or_r = readString()
  val str = readString()
  fun translate(c : Char) : Char {
    val kb_nullable = charToKb[c]
    if (kb_nullable == null) {
      throw Exception("1. Could not translate character!")
    } else {
      val kb = kb_nullable
      val kb_nbr = kb.neighbor(l_or_r)
      val nbr_c_nullable = kbToChar[kb_nbr]
      if (nbr_c_nullable == null) {
        throw Exception("2. Could not translate character!")
      } else {
        val nbr_c = nbr_c_nullable
        return nbr_c
      }
    }
  }
  str.forEach({c -> val t = translate(c)
                    print(t) })
  println()
}

import java.util.*

/**
 * Created by tux on 08.11.16.
 */

fun main(args: Array<String>) {
    val K = listOf("qwertyuiop", "asdfghjkl;", "zxcvbnm,./")
    val M = HashMap<Char, Pair<Int, Int>>()
    for (j in 0..(K.size - 1)) {
        for (i in 0..(K[j].length - 1)) {
            M.put(K[j][i], Pair(j, i))
        }
    }

    val offset = if (readLine()!![0] == 'R') -1 else +1
    var ret = ""
    readLine()!!.forEach {
        val p = M[it]!!
        ret += K[p.first][p.second + offset]
    }
    println(ret)
}

fun main(args: Array<String>) {

    val first = "qwertyuiopasdfghjkl;zxcvbnm,./"

    val command = readLine()!!

    val message = readLine()!!

    var result= ""

    message.forEach { c ->
        val position = first.indexOf(c)
        result += if (command == "R"){
            first[position - 1]
        }else{
            first[position + 1]
        }

    }

    println(result)
}

import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.*
import kotlin.system.measureTimeMillis

fun getMinimumAmountOfChangeFrom(amount: Int): Int {
    val changes = listOf(10, 5, 1)
    var availableAmount = amount
    var numOfCoins = 0
    for (change in changes) {
        while (availableAmount > 0 && availableAmount / change.toDouble() >= 1) {
            numOfCoins += 1
            availableAmount -= change
        }
    }
    return numOfCoins
}

fun getMaximumValueOfTheLootWith(
    W: Int,
    valuePerUnitAndWeight: List<Pair<Double, Int>>
): Double {
    var maximumLootValue = 0.0
    var availableWeight = W
    for (pair in valuePerUnitAndWeight) {
        var availableWeightOfLootItem = pair.second
        while (availableWeight > 0 && availableWeightOfLootItem > 0) {
            maximumLootValue += pair.first
            availableWeightOfLootItem -= 1
            availableWeight -= 1
        }
    }
    return maximumLootValue
}

fun getMinimumNumOfRefills(d: Int, m: Int, stops: List<Int>): Int {
    var availableDistance = d
    var minimumRefills = 0
    var currentRefill = 0
    var lastRefill = 0
    val realStops = listOf<Int>(0, *stops.toTypedArray(), d)
    while (availableDistance > 0 && currentRefill < realStops.size) {
        var movedForward = false
        while (currentRefill < realStops.size && (realStops[currentRefill] - realStops[lastRefill]) <= m) {
            if (realStops[currentRefill] - realStops[lastRefill] == 0) {
                movedForward = false
                currentRefill++
            } else {
                movedForward = true
                currentRefill++
            }
        }
        if (movedForward) {
            minimumRefills++
            currentRefill--
            availableDistance -= (realStops[currentRefill] - realStops[lastRefill])
            lastRefill = currentRefill
        } else {
            return -1
        }
    }
    return minimumRefills - 1
}

fun getMaximizedSumOfProduct(profitPerClick: List<Int>, averageNumberOfClicks: List<Int>): Long {
    var sum = 0L
    println(profitPerClick.toString())
    println(averageNumberOfClicks.toString())
    profitPerClick.forEachIndexed { index, profit ->
        sum += profit * averageNumberOfClicks[index]
    }
    return sum
}

fun getCommon(first: Int, last: Int, segments: MutableList<Pair<Int, Int>>): String {
    var current = first
    val common = mutableListOf<Pair<Int, Int>>()
    while (current <= last) {
        var numOfTimes = 0
        for (pair in segments) {
            if (current in pair.first..pair.second) {
                numOfTimes++
            }
        }
        if (numOfTimes > 1) {
            common.add(Pair(current, numOfTimes))
        }
        current++
    }
    common.sortByDescending { it -> it.second }
    if (common.first().second == segments.size) {
        return "1\n${common.first().first}"
    }
    println(common)
    return "${common.size}\n${common.map { it.first }.joinToString(" ")}"
}

fun getMaximumSetOfPrizes(n: Int): String {
    var numbersOfN = ""
    var sumSoFar = 0
    if (n <= 2) {
        return "1\n$n"
    }
//    println("2*square root of n = ${2 * sqrt(n.toDouble())}")
//    for (i in 1..(2 * sqrt(n.toDouble()).toInt())){
//        if (i+sumSoFar<=n){
//            numbersOfN+="$i "
//            sumSoFar+=i
//        }
//    }
//    var lastNumber = 1
    var currentNumber = 1
    while (((currentNumber + 1) + currentNumber) <= n - sumSoFar) {
        sumSoFar += currentNumber
        numbersOfN += "$currentNumber "
        currentNumber++
    }
    if (((n - currentNumber) + sumSoFar) == n || n - sumSoFar > 0) {
        currentNumber = n - sumSoFar
        sumSoFar += currentNumber
        numbersOfN += "$currentNumber "
    }
//    else if (n-sumSoFar>0){
//        currentNumber = n-sumSoFar
//        numbersOfN += "$currentNumber "
//    }
    return "${numbersOfN.trim().split(" ").size}\n$numbersOfN"
}

fun linelandMail(coordinates: List<Long>): String {
    val mins = mutableListOf<Long>()
    val maxs = mutableListOf<Long>()
    for (i in coordinates.indices) {
        if (i == 0) {
            mins.add(abs(coordinates[i] - coordinates[i + 1]))
            maxs.add(abs(coordinates[i] - coordinates[coordinates.size - 1]))
        } else if (i == coordinates.size - 1) {
            mins.add(abs(coordinates[i] - coordinates[i - 1]))
            maxs.add(abs(coordinates[i] - coordinates[0]))
        } else {
            if (abs(coordinates[i] - coordinates[i - 1])
                > abs(coordinates[i] - coordinates[i + 1])
            )
                mins.add(abs(coordinates[i] - coordinates[i + 1]))
            else
                mins.add(abs(coordinates[i] - coordinates[i - 1]))

            if (abs(coordinates[i] - coordinates[0])
                < abs(coordinates[i] - coordinates[coordinates.size - 1])
            )
                maxs.add(abs(coordinates[i] - coordinates[coordinates.size - 1]))
            else
                maxs.add(abs(coordinates[i] - coordinates[0]))
        }
    }
    return mins
        .zip(maxs)
        .map { pair -> "${pair.first} ${pair.second}" }
        .joinToString("\n")
}

fun snacktower(snacksWeights: List<Int>) {
    val n = snacksWeights.size
    var currentMax = n
    var current = 0
    var processed = mutableListOf<Int>()
    while (current < snacksWeights.size) {
        if (snacksWeights[current] < currentMax) {
            processed.add(snacksWeights[current])
            print("\n")
            current++
        } else {
            if (snacksWeights[current] == currentMax) {
                print(currentMax)
                currentMax--
                var currentProcessed = 0
                while (currentProcessed < processed.size) {
                    var foundConsecutive = false
                    if (processed[currentProcessed] == currentMax) {
                        print(" ")
                        print(processed[currentProcessed])
                        currentMax--
                        foundConsecutive = true
                        processed = processed.swap(currentProcessed, processed.size - 1).toMutableList()
                        processed.removeAt(processed.size - 1)
                    }
                    if (!foundConsecutive) {
                        currentProcessed++
                    } else {
                        currentProcessed = 0
                    }
                }
                println()
                current++
            }
        }
    }
}

fun <T> List<T>.swap(a: Int, b: Int): List<T> = this
    .toMutableList()
    .also {
        it[a] = this[b]
        it[b] = this[a]
    }

fun `Oath of the Night's Watch`(stewardsStrengths: List<Int>) {
    val sortedStrengths = stewardsStrengths.sorted()
    var numberOfThoseWhoNeedSupport = 0
    for (strengthIndex in sortedStrengths.indices) {
        val precedingSteward = strengthIndex - 1
        val nextSteward = strengthIndex + 1
        if (precedingSteward>=0 && nextSteward<sortedStrengths.size){
            if (sortedStrengths[precedingSteward]<sortedStrengths[strengthIndex]
                && sortedStrengths[nextSteward]>sortedStrengths[strengthIndex]){
                numberOfThoseWhoNeedSupport++
            }
        }
    }
    println(numberOfThoseWhoNeedSupport)
}

fun pangram(characters: String){
    print(if (characters.toLowerCase().toSet().size==26) "YES" else "NO")
}

fun twins(coinsValues: List<Int>){
    val sortedValues = coinsValues.sortedDescending()
    var mySumSoFar = 0
    var numberOfCoinsIWillTake = 0
    for (index in sortedValues.indices){
        mySumSoFar+=sortedValues[index]
        numberOfCoinsIWillTake++
        if (mySumSoFar>sortedValues.subList(index+1,sortedValues.size).sum()){
            break
        }
    }
    println(numberOfCoinsIWillTake)
}

fun keyboard(handSlippedTo: Char, codedMessage: String){
    val hisKeyboard = "qwertyuiopasdfghjkl;zxcvbnm,./"
    for (char in codedMessage){
        when(handSlippedTo){
            'R'->{
                print(hisKeyboard[hisKeyboard.indexOf(char)-1])
            }
            'L'->{
                print(hisKeyboard[hisKeyboard.indexOf(char)+1])
            }
        }
    }
}
fun main() {

//    val scanner = Scanner(System.`in`)
//    val n = scanner.nextInt()
//    val snacksWeights = MutableList<Int>(n) { index -> 0 }
//    for (i in 0 until n) {
//        snacksWeights[i] = scanner.nextInt()
//    }
//    snacktower(snacksWeights)
//    val scanner = Scanner(System.`in`)
//    val n = scanner.nextInt()
//    val strengths = MutableList<Int>(n) { index -> 0 }
//    for (i in 0 until n) {
//        strengths[i] = scanner.nextInt()
//    }
//    `Oath of the Night's Watch`(strengths)
    val scanner = Scanner(System.`in`)
    val direction = scanner.next()
    val codedMessage = scanner.next()
    keyboard(direction[0],codedMessage)
}

// start of stress test
//    while (true) {
//        val n = Random.nextLong(1000000)
//        val m = Random.nextLong(100000)
//        if (m<n){
//            val res1 = getFibonacciPartialSumNaive(m,n)
//            val res2 = getLastDigitOfSumOfSubsetOfFibs(m,n)
//            if (res1.toInt() == res2) {
//                println("Ok")
//            } else {
//                println("Wrong Answer at n = $n and m = $m")
//                print("$res1 $res2")
//                break
//            }
//        }
//
//    }

fun main(args: Array<String>) {
    val strs = arrayOf<String>("qwertyuiop", "asdfghjkl;", "zxcvbnm,./")
    val R = mutableMapOf<Char, Char>()
    val L = mutableMapOf<Char, Char>()
    for (str in strs) {
        for (i in 1..str.length-1) {
            R.put(str[i-1], str[i])
            L.put(str[i], str[i-1])
        }
    }
    val dir = readLine()!![0]
    val s = readLine()!!
    for (c in s) {
        if (dir == 'R') {
            print(L[c])
        } else {
            print(R[c])
        }
    }
    print("\n")
}

fun main(args: Array<String>) {
    val t = "qwertyuiopasdfghjkl;zxcvbnm,./"
    val s = readLine()
    val m = if (s=="R") -1
    else 1
    val z = readLine()!!.toString()
    for (c in z) print(t[t.indexOf(c)+m])
}

import java.util.Scanner

fun main(args: Array<String>) {
    val input = Scanner(System.`in`)
    var Direction: String = input.next()
    var Word: String = input.next()
    var lettList = ArrayList<Char>()

    val keyboard = "qwertyuiop[]asdfghjkl;'zxcvbnm,./"

    for(letter in Word.indices) {
        for (checker in keyboard.indices) {
            if(Word.get(letter) == keyboard.get(checker)) {
                if(Direction.equals("R")) {
                    lettList.add(keyboard.get(checker-1))
                } else {
                    lettList.add(keyboard.get(checker+1))
                }
            }
        }
    }

    var Res: String = lettList.joinToString("")
    println(Res)
}

fun main(args:Array<String>) {
    val a="qwertyuiopsdfghjkl;zxcvbnm,./"
    val LR= readLine()!!
    var x= readLine()!!
    var result=""
    var f=1
    if(LR=="R")
        f*=-1
    for(i in 0 until x.length){
      result+=a[a.indexOf(x[i])+f]
    }
    println(result)
}

import java.lang.AssertionError
import java.util.*

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

private fun myAssert(x: Boolean) {
    if (!x) {
        throw AssertionError()
    }
}

fun main(args: Array<String>) {
//  var s = Scanner(System.`in`)
  var cmd = readLn()
  var line = readLn()
  var map = mutableMapOf<Char, Char>()
  var keyboard = "qwertyuiopasdfghjkl;zxcvbnm,./"
  if (cmd == "R") {
    for (i in 1..keyboard.length - 1) {
      map[keyboard[i]] = keyboard[i - 1]
    }
    for (i in 0..line.length - 1) {
      print("${map[line[i]]}")
    }
    print("\n")
  } else {
    for (i in 0..keyboard.length - 2) {
      map[keyboard[i]] = keyboard[i + 1]
    }
    for (i in 0..line.length - 1) {
      print("${map[line[i]]}\n")
    }
    print("\n")
  }
}


You are given a string s consisting of n lowercase Latin letters. You have to type this string using your keyboard.Initially, you have an empty string. Until you type the whole string, you may perform the following operation:  add a character to the end of the string. Besides, at most once you may perform one additional operation: copy the string and append it to itself.For example, if you have to type string abcabca, you can type it in 7 operations if you type all the characters one by one. However, you can type it in 5 operations if you type the string abc first and then copy it and type the last character.If you have to type string aaaaaaaaa, the best option is to type 4 characters one by one, then copy the string, and then type the remaining character.Print the minimum number of operations you need to type the given string.

The first line of the input containing only one integer number n (1 ≤ n ≤ 100) — the length of the string you have to type. The second line containing the string s consisting of n lowercase Latin letters.

Print one integer number — the minimum number of operations you need to type the given string.

NoteThe first test described in the problem statement.In the second test you can only type all the characters one by one.

import java.io.*
import java.util.*
import kotlin.math.min

fun main(args: Array<String>) {
    solve(System.`in`, System.out)
}

val MAX_N = (1e6 + 10).toInt()
val INF = (1e9 + 7).toInt()
val MOD = (1e9 + 7).toInt()

fun solve(input: InputStream, output: OutputStream) {
    val reader = InputReader(BufferedInputStream(input))
    val writer = PrintWriter(BufferedOutputStream(output))

    solve(reader, writer)
    writer.close()
}

fun solve(reader: InputReader, writer: PrintWriter) {
    val n = reader.nextInt()
    val s = reader.next()

    var ans = n

    for (l in (0 until n / 2).reversed()) {
        val pref = s.slice(0..l)
        val r = 2 * l + 1
        val nexts = s.slice(l + 1..r)

        if (pref == nexts) {
            val t = pref.length + 1 + (n - 2 * pref.length)
            ans = min(ans, t)
        }
    }
    writer.println(ans)
}

class InputReader(stream: InputStream) {
    val reader: BufferedReader
    var tokenizer: StringTokenizer? = null

    init {
        reader = BufferedReader(InputStreamReader(stream), 32768)
        tokenizer = null
    }

    operator fun next(): String {
        while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }

    fun nextInt(): Int {
        return Integer.parseInt(next())
    }

    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }

    fun nextArrayInt(count: Int): IntArray {
        return nextArrayInt(0, count)
    }

    fun nextArrayInt(start: Int, count: Int): IntArray {
        val a = IntArray(start + count)
        for (i in start until start + count) {
            a[i] = nextInt()
        }
        return a
    }

    fun nextArrayLong(count: Int): LongArray {
        val a = LongArray(count)
        for (i in 0 until count) {
            a[i] = nextLong()
        }
        return a
    }
}

import java.util.*
import kotlin.math.*

fun check(s: String, start: Int): Boolean {
    for (i in 0 until start) {
        if (start + i >= s.length || s[i] != s[start + i])
            return false
    }
    return true
}

fun main(args: Array<String>) {
    Scanner(System.`in`.buffered()).use {
        val n = it.nextInt()
        val s = it.next()

        var ans = n
        for (i in 1 .. n / 2) {
            if (check(s, i))
                ans = min(ans, i + 1 + n - 2 * i)
        }

        println(ans)
    }
}


Luba is surfing the Internet. She currently has n opened tabs in her browser, indexed from 1 to n from left to right. The mouse cursor is currently located at the pos-th tab. Luba needs to use the tabs with indices from l to r (inclusive) for her studies, and she wants to close all the tabs that don't belong to this segment as fast as possible.Each second Luba can either try moving the cursor to the left or to the right (if the cursor is currently at the tab i, then she can move it to the tab max(i - 1, a) or to the tab min(i + 1, b)) or try closing all the tabs to the left or to the right of the cursor (if the cursor is currently at the tab i, she can close all the tabs with indices from segment [a, i - 1] or from segment [i + 1, b]). In the aforementioned expressions a and b denote the minimum and maximum index of an unclosed tab, respectively. For example, if there were 7 tabs initially and tabs 1, 2 and 7 are closed, then a = 3, b = 6.What is the minimum number of seconds Luba has to spend in order to leave only the tabs with initial indices from l to r inclusive opened?

The only line of input contains four integer numbers n, pos, l, r (1 ≤ n ≤ 100, 1 ≤ pos ≤ n, 1 ≤ l ≤ r ≤ n) — the number of the tabs, the cursor position and the segment which Luba needs to leave opened.

Print one integer equal to the minimum number of seconds required to close all the tabs outside the segment [l, r].

NoteIn the first test Luba can do the following operations: shift the mouse cursor to the tab 2, close all the tabs to the left of it, shift the mouse cursor to the tab 3, then to the tab 4, and then close all the tabs to the right of it.In the second test she only needs to close all the tabs to the right of the current position of the cursor.In the third test Luba doesn't need to do anything.

import kotlin.math.abs

fun main() {
    var (n, pos, l, r) = readLine()!!.split(" ").map(String::toInt)
    val toDelete = mutableListOf<Pair<Int, Int>>()
    if (l > 1)
        toDelete.add(pos - l to l)
    if (r < n)
        toDelete.add(r - pos to r)
    toDelete.sortBy { it.first }
    var sol = 0
    for(tab in toDelete) {
        sol += abs(pos -tab.second) + 1
        pos = tab.second
    }
    print(sol)
}

import java.io.*
import java.util.*
import kotlin.math.abs
import kotlin.math.min

class B {
    fun solve(input : InputStream, output : OutputStream) {
        val reader = InputReader(BufferedInputStream(input))
        val writer = PrintWriter(BufferedOutputStream(output))

        val n = reader.nextInt()
        val pos = reader.nextInt()
        val l = reader.nextInt()
        val r = reader.nextInt()

        writer.println(solve(n, pos, l, r))

        writer.close()
    }

    fun range(a : Int, b : Int) : Int {
        return abs(a - b)
    }

    fun solve(n : Int, pos : Int, l : Int, r : Int) : Int {
        if (l == 1 && r == n) {
            return 0
        }
        if (l == 1) {
            return range(pos, r) + 1
        }
        if (r == n) {
            return range(pos, l) + 1
        }

        val leftFirst = range(pos, l) + 1 + range(l, r) + 1
        val rightFirst = range(pos, r) + 1 + range(l, r) + 1
        return min(leftFirst, rightFirst)
    }

    private class InputReader(stream: InputStream) {
        var reader: BufferedReader
        var tokenizer: StringTokenizer? = null

        init {
            reader = BufferedReader(InputStreamReader(stream), 32768)
            tokenizer = null
        }

        operator fun next(): String {
            while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
                try {
                    tokenizer = StringTokenizer(reader.readLine())
                } catch (e: IOException) {
                    throw RuntimeException(e)
                }

            }
            return tokenizer!!.nextToken()
        }

        fun nextInt(): Int {
            return Integer.parseInt(next())
        }

        fun nextLong(): Long {
            return java.lang.Long.parseLong(next())
        }
    }
}

fun main(args : Array<String>) {
    B().solve(System.`in`, System.out)
}

import java.util.*

fun abs(x: Int) = if (x >= 0) x else -x

fun main(args: Array<String>) = with(Scanner(System.`in`)) {
    val n = nextInt(); val pos = nextInt()
    val l = nextInt(); val r = nextInt()

    val leftToRight = abs(pos - l) + 1 + (1 + r - l) * (if (r != n) 1 else 0)
    val rightToLeft = abs(r - pos) + 1 + (1 + r - l) * (if (l != 1) 1 else 0)

    if (l == 1 && r == n) {
        print(0)
    } else {
        print(minOf(leftToRight, rightToLeft))
    }
}

fun main() {
    val (n, pos, l, r) = readLine()!!.split(" ").map(String::toInt)
    val toDelete = mutableListOf<Int>()
    if (l > 1)
        toDelete.add(pos - l)
    if (r < n)
        toDelete.add(r - pos)
    toDelete.sort()
    var sol = 0
    when (toDelete.size) {
        1 -> sol += toDelete[0] + 1
        2 -> sol += toDelete[0] + 1 + toDelete[0] + toDelete[1] + 1
    }
    print(sol)
}

import java.util.*

fun main(args: Array<String>) = with(Scanner(System.`in`)) {
    val n = nextInt(); val pos = nextInt()
    val l = nextInt(); val r = nextInt()

    val leftToRight = pos - l + 1 + (1 + r - l) * (if (r != n) 1 else 0)
    val rightToLeft = r - pos + 1 + (1 + r - l) * (if (l != 1) 1 else 0)

    if (l == 1 && r == n) {
        print(0)
    } else {
        print(minOf(leftToRight, rightToLeft))
    }
}


Today is Mashtali's birthday! He received a Hagh tree from Haj Davood as his birthday present!A directed tree is called a Hagh tree iff:   The length of the longest directed path in it is exactly $$$n$$$.  Every vertex has at most three edges attached to it independent of their orientation.  Let's call vertices $$$u$$$ and $$$v$$$ friends if one of them has a directed path to the other. For every pair of vertices $$$u$$$ and $$$v$$$ that are not friends, there should exist a vertex $$$w$$$ that is friends with both $$$u$$$ and $$$v$$$ (a mutual friend). After opening his gift, Mashtali found out that the labels on the vertices were gone.Immediately, he asked himself: how many different unlabeled Hagh trees are there? That is, how many possible trees could he have received as his birthday present?At the first glance, the number of such trees seemed to be infinite since there was no limit on the number of vertices; but then he solved the problem and proved that there's a finite number of unlabeled Hagh trees!Amazed by this fact, he shared the task with you so that you could enjoy solving it as well. Since the answer can be rather large he asked you to find the number of different unlabeled Hagh trees modulo $$$998244353$$$.Here two trees are considered different, if they are not isomorphic: if there is no way to map nodes of one tree to the second tree, so that edges are mapped to edges preserving the orientation.Some examples for $$$n = 2$$$:   Directed trees $$$D$$$ and $$$E$$$ are Hagh. $$$C$$$ is not Hagh because it has a vertex with $$$4$$$ edges attached to it. $$$A$$$ and $$$B$$$ are not Hagh because their longest directed paths are not equal to $$$n$$$. Also in $$$B$$$ the leftmost and rightmost vertices are not friends neither do they have a mutual friend.

The first line of input contains a single integer $$$n$$$ $$$(1 \le n \le 10^6)$$$.

Print a single integer, the answer to Mashtali's task modulo $$$998244353$$$.

NoteAll the five Hagh trees for $$$n = 1$$$:

// 2022.06.23 at 21:23:35 HKT
import java.io.BufferedInputStream
import java.io.File
import java.io.PrintWriter
import kotlin.system.measureTimeMillis
import java.util.TreeMap
import java.util.TreeSet
import kotlin.random.Random
import kotlin.random.nextInt

// 1. Modded
const val p = 998244353L
const val pI = p.toInt()
fun Int.adjust():Int{ if(this >= pI){ return this  - pI }else if (this < 0){ return this + pI };return this }
fun Int.snap():Int{ if(this >= pI){return this - pI} else return this}
infix fun Int.modM(b:Int):Int{ return ((this.toLong() * b) % pI).toInt() }
infix fun Int.modPlus(b:Int):Int{ val ans = this + b;return if(ans >= pI) ans - pI else ans }
fun intPow(x:Int,e:Int,m:Int):Int{
    var X = x ; var E =e ; var Y = 1
    while(E > 0){
        if(E and 1 == 0){
            X = ((1L * X * X) % m).toInt()
            E = E shr 1
        }else{
            Y = ((1L * X * Y) % m).toInt()
            E -= 1
        }
    }
    return Y
}
// 2. DP initial values
const val plarge = 1_000_000_727
const val nlarge = -plarge
const val phuge = 2_727_000_000_000_000_000L
const val nhuge = -phuge
// 3. conveniecen conversions
val Boolean.chi:Int get() = if(this) 1 else 0 //characteristic function
val Char.code :Int get() = this.toInt() -  'a'.toInt()
//3. hard to write stuff
fun IntArray.put(i:Int,v:Int){ this[i] = (this[i] + v).adjust() }
val mint:MutableList<Int> get() = mutableListOf<Int>()
val mong:MutableList<Long> get() = mutableListOf<Long>()
//4. more outputs
fun List<Char>.conca():String = this.joinToString("")
val CharArray.conca :String get() = this.joinToString("")
val IntArray.conca :String get() = this.joinToString(" ")
@JvmName("concaInt")
fun List<Int>.conca():String = this.joinToString(" ")
val LongArray.conca:String get() = this.joinToString(" ")
@JvmName("concaLong")
fun List<Long>.conca():String = this.joinToString(" ")
//5. Pair of ints
const val longmask = (1L shl 32) - 1
fun makepair(a:Int, b:Int):Long = (a.toLong() shl 32) xor (longmask and b.toLong()) // remember positev sonly
val Long.first get() = (this ushr 32).toInt()
val Long.second get() = this.toInt()
//6. strings
val String.size get() = this.length
const val randCount = 100
//7. bits
fun Int.has(i:Int):Boolean = (this and (1 shl i) != 0)
fun Long.has(i:Int):Boolean = (this and (1L shl i) != 0L)
//8 TIME
inline fun TIME(f:()->Unit){
    val t = measureTimeMillis(){
        f()
    }
    println("$t ms")
}
object Reader{
    private const val BS = 1 shl 16
    private const val NC = 0.toChar()
    private val buf = ByteArray(BS)
    private var bId = 0
    private var size = 0
    private var c = NC

    var warningActive = true
    var fakein = StringBuilder()

    private var IN: BufferedInputStream = BufferedInputStream(System.`in`, BS)
    val OUT: PrintWriter = PrintWriter(System.out)

    private val char: Char
        get() {
            while (bId == size) {
                size = IN.read(buf) // no need for checked exceptions
                if (size == -1) return NC
                bId = 0
            }
            return buf[bId++].toChar()
        }

    fun nextInt(): Int {
        var neg = false
        if (c == NC) c = char
        while (c < '0' || c > '9') {
            if (c == '-') neg = true
            c = char
        }
        var res = 0
        while (c in '0'..'9') {
            res = (res shl 3) + (res shl 1) + (c - '0')
            c = char
        }
        return if (neg) -res else res
    }
    fun nextLong(): Long {
        var neg = false
        if (c == NC) c = char
        while (c < '0' || c > '9') {
            if (c == '-') neg = true
            c = char
        }
        var res = 0L
        while (c in '0'..'9') {
            res = (res shl 3) + (res shl 1) + (c - '0')
            c = char
        }
        return if (neg) -res else res
    }
    fun nextString():String{
        val ret = StringBuilder()
        while (true){
            c = char
            if(!isWhitespace(c)){ break}
        }
        ret.append(c)
        while (true){
            c = char
            if(isWhitespace(c)){ break}
            ret.append(c)
        }
        return ret.toString()
    }
    fun isWhitespace(c:Char):Boolean{
        return c == ' ' || c == '\n' || c == '\r' || c == '\t'
    }
    fun rerouteInput(){
        if(warningActive){
            put("Custom test enabled")
            println("Custom test enabled")
            warningActive = false
        }
        val S = fakein.toString()
        println("New Case ")
        println(S.take(80))
        println("...")
        fakein.clear()
        IN = BufferedInputStream(S.byteInputStream(),BS)
    }
    fun takeFile(name:String){
        IN = BufferedInputStream(File(name).inputStream(),BS)
    }
}
fun put(aa:Any){ Reader.OUT.println(aa)}
fun done(){ Reader.OUT.close() }
fun share(aa:Any){
    if(aa is IntArray){Reader.fakein.append(aa.joinToString(" "))}
    else if(aa is LongArray){Reader.fakein.append(aa.joinToString(" "))}
    else if(aa is List<*>){Reader.fakein.append(aa.toString())}
    else{Reader.fakein.append(aa.toString())}
    Reader.fakein.append("\n")
}

val getintfast:Int get() = Reader.nextInt()
val getint:Int get(){ val ans = getlong ; if(ans > Int.MAX_VALUE) IntArray(1000000000); return ans.toInt() }
val getlong:Long get() = Reader.nextLong()
val getstr:String get() = Reader.nextString()
fun getline(n:Int):IntArray{
    return IntArray(n){getint}
}
fun getlineL(n:Int):LongArray{
    return LongArray(n){getlong}
}
var dmark = -1
infix fun Any.dei(a:Any){
    dmark++
    var str = "<${dmark}>   "
    debug()
    if(this is String){ str += this
    }else if(this is Int){ str += this.toString()
    }else if(this is Long){ str += this.toString()
    }else{ str += this.toString()}
    if(a is List<*>){ println("$str : ${a.joinToString(" ")}")
    }else if(a is IntArray){ println("$str : ${a.joinToString(" ")}")
    }else if(a is LongArray){ println("$str : ${a.joinToString(" ")}")
    }else if(a is BooleanArray){ println("$str :${a.map{if(it)'1' else '0'}.joinToString(" ")}")
    }else if(a is Array<*>){
        println("$str : ")
        for(c in a){if(c is IntArray){println(c.joinToString(" "))}
        else if(c is LongArray){println(c.joinToString(" "))}
        else if(c is BooleanArray){println(c.map { if(it) '1' else '0' }.joinToString(""))
        }
        }
        println()
    }else{ println("$str : $a")
    }
}
val just = " "
fun crash(){
    throw Exception("Bad programme")}
fun assert(a:Boolean){
    if(!a){
        throw Exception("Failed Assertion")
    }}
enum class solveMode {
    real, rand, tc
}
object solve{
    var mode:solveMode = solveMode.real
    var tcNum:Int = 0
    var rand:()->Unit = {}
    var TC:MutableMap<Int,()->Unit> = mutableMapOf()
    var tn:Long = 0
    fun cases(onecase:()->Unit){
        val t = if(mode == solveMode.real){if(singleCase) 1 else getint} else if(mode == solveMode.tc){1 } else randCount
        if(pI != 998_244_353 && pI != 1_000_000_007){
            throw Exception("Not usual primes!")
        }
        if(t == 1 && mode != solveMode.real){
            tn = System.currentTimeMillis()
        }
        repeat(t){
            if(mode == solveMode.tc){
                TC[tcNum]?.let { it() }
                Reader.rerouteInput()
            }else if(mode == solveMode.rand){
                rand()
                Reader.rerouteInput()
            }
            onecase()
        }
        if(t == 1 && mode != solveMode.real){
            val dt = System.currentTimeMillis() - tn
            println("Time $dt ms ")
        }
    }
    inline fun singleCase(a:solve.()->Unit){
        val t = if(mode != solveMode.rand){1} else randCount
        repeat(t) { a() }
    }
    fun rand(a:()->Unit){
        this.rand = a
    }
    fun tc(id:Int = 0,a:()->Unit){
        TC[id] = a
    }
    fun usetc(a:Int = 0 ){
        this.tcNum = a
        this.mode = solveMode.tc
    }
    fun userand(){
        this.mode = solveMode.rand
    }
}

infix fun Long.modM(b:Long):Long{
    return (this * b) % p
}
//infix fun Int.modPlus(b:Int):Int{
//    val ans = this + b
//    return if(ans >= pI) ans - pI else ans
//}
infix fun Int.modMinus(b:Int):Int{
    val ans = this - b
    return if(ans < 0) ans + pI else ans
}
infix fun Int.modDivide(b:Int):Int{
    return this modM (b.inverse())
}
fun Int.additiveInverse():Int{
    return if(this == 0) 0 else pI - this
}

fun intPowEXP(x:Int,e:Long,m:Int):Int{
    var X = x
    var E =e
    var Y = 1
    while(E > 0){
        if(E % 2 == 0L){
            X = ((1L * X * X) % m).toInt()
            E = E shr 1
        }else{
            Y = ((1L * X * Y) % m).toInt()
            E -= 1
        }
    }
    return Y
}

fun pow(x:Long,e:Long,m:Long):Long{
    var X = x
    var E =e
    var Y = 1L
    while(E > 0){
        if(E % 2 == 0L){
            X = (X * X) % m
            E /= 2
        }else{
            Y = (X * Y) % m
            E -= 1
        }
    }
    return Y
}
fun Long.inverse():Long{
    return pow(this,p-2,p)
}
fun Int.inverse():Int{
    return intPow(this,pI-2,pI)
}
fun min_rem(m:Int, r:Int, c:Int):Int {
    if(c < 1){
        return Int.MIN_VALUE
    }else if(r == 0){
        return 0
    }else{
        val step = m % r
        val mx = ((1L * c * r) /m ).toInt()
        val t = max_rem(r,step,mx)
        return r- t
    }
}
fun max_rem(m:Int, r:Int, c:Int):Int {
    if(r == 0|| c <= m/r){
        return r * c
    }else{
        val step =  m % r
        val mx = ((1L * (c+1) * r )/m).toInt()
        val t = min_rem(r,step,mx)
        return  m - t
    }
}
fun Int.reconstruct():String{
    val num = min_rem(pI,this, 10000)
    val denom = (this modDivide num).inverse()
    return "$num / $denom"
}

//make this int instead
class FACT{
    companion object {
        var store = IntArray(0)
        var invStore = IntArray(0)

        var slowStore:IntArray = IntArray(0)

        fun preCal(upto:Int){
            store = IntArray(upto+1)
            invStore = IntArray(upto + 1 )
            store[0] = 1
            invStore[0] = 1

            for(i in 1..upto) {
                store[i] = store[i-1] modM i
                invStore[i] = invStore[i-1] modM (i.inverse())
            }
        }
        fun choose(n:Int,r:Int):Int{
            if(r < 0 || r > n) return 0
            val a = store[n]
            val b = invStore[n-r]
            val c = invStore[r]
            return (a modM b) modM c
        }

        fun bigChoose(n:Int,r:Int):Int{
            var ret = 1
            for(i in 0 until r){
                ret = ret modM (n - i)
            }
            ret = ret modM (invStore[r])
            return ret
        }

    }
}

fun debug(){}
const val singleCase = true
fun main(){
    FACT.preCal(100)
    solve.cases{
        val n = getint
        val max = 1000001
        val root1 = IntArray(max)
        val root2 = IntArray(max)
        val root3 = IntArray(max)
        val onetwosum = IntArray(max)
        root1[1] = 1
        root2[1] = 1
        root3[1] = 1
        onetwosum[0] = 1
        onetwosum[1] = 3 // any length, from 0 upto i
        for(i in 2 until max){
            val base = onetwosum[i-1]
            val reject = onetwosum[i-2]
            root1[i] = base modMinus reject
            root2[i] = FACT.bigChoose(base + 1, 2) modMinus FACT.bigChoose(reject + 1,2)
            root3[i] = FACT.bigChoose(base + 2 , 3) modMinus FACT.bigChoose(reject + 2 , 3)
            onetwosum[i] = onetwosum[i-1] modPlus (root1[i] modPlus root2[i])
        }
        var fullret = 0
        for(anchor in 0..n){
            val right = n - anchor
            val left = anchor
            var ret =  ( root1[left] modM root2[right])
            //(root1[right] modM root1[left]) modPlus (root1[right] modM root2[left]) modPlus
            fullret = ret modPlus fullret
        }
        fullret = fullret modPlus ((root3[n] modPlus root2[n] modPlus root1[n]) modM 2) modMinus root1[n]
        put(fullret)

    }
    done()
}