Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that they talked very often and eventually they became a couple in the network. But yesterday, he came to see "her" in the real world and found out "she" is actually a very strong man! Our hero is very sad and he is too tired to love again now. So he came up with a way to recognize users' genders by their user names.This is his method: if the number of distinct characters in one's user name is odd, then he is a male, otherwise she is a female. You are given the string that denotes the user name, please help our hero to determine the gender of this user by his method.

The first line contains a non-empty string, that contains only lowercase English letters — the user name. This string contains at most 100 letters.

If it is a female by our hero's method, print "CHAT WITH HER!" (without the quotes), otherwise, print "IGNORE HIM!" (without the quotes).

CHAT WITH HER!
IGNORE HIM!
CHAT WITH HER!

NoteFor the first example. There are 6 distinct characters in "wjmzbmr". These characters are: "w", "j", "m", "z", "b", "r". So wjmzbmr is a female and you should print "CHAT WITH HER!".

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.*

fun main(args: Array<String>) {

    val scanner = Scanner(System.`in`)
    val n = scanner.next()
    val set = TreeSet<Char>()
    for (i in n)
        set.add(i)
    if (set.size % 2 == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")

}

class Scanner(s: InputStream) {
    var st: StringTokenizer? = null
    var br: BufferedReader = BufferedReader(InputStreamReader(s))
    @Throws(IOException::class)
    operator fun next(): String {
        while (st == null || !st!!.hasMoreTokens())
            st = StringTokenizer(br.readLine())
        return st!!.nextToken()
    }
    @Throws(IOException::class)
    fun nextInt(): Int {
        return Integer.parseInt(next())
    }
    @Throws(IOException::class)
    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }
    @Throws(IOException::class)
    fun nextLine(): String {
        return br.readLine()
    }
    @Throws(IOException::class)
    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }
    @Throws(IOException::class)
    fun ready(): Boolean {
        return br.ready()
    }
}
//class Pair(var a: Int, var b: Int): Comparable<Pair> {
//    override fun compareTo(other: Pair): Int {
//        return b - a - other.b + other.a
//    }
//}

fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readDouble() = readLn().toDouble()
fun readLong() = readLn().toLong()
fun readStrings() = readLn().split(' ')
fun readInts() = readStrings().map { it.toInt() }
fun readDoubles() = readStrings().map { it.toDouble() }
fun readLongs() = readStrings().map { it.toLong() }

fun getUnique(s: String): Int {
    val unique = hashSetOf<Char>()
    for (ch in s) unique.add(ch)
    return unique.size
}

fun main(args: Array<String>) {
    val s = readLn()
    println(if (getUnique(s) % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

// kotlin oj template code from uwi(Codeforces), and convert to kotlin by lety
import java.io.ByteArrayInputStream
import java.io.IOException
import java.io.InputStream
import java.io.PrintWriter
import java.util.Arrays
import java.util.InputMismatchException
import kotlin.math.absoluteValue

lateinit var `is`: InputStream
lateinit var out: PrintWriter
var INPUT = ""

//val oj = System.getProperty("ONLINE_JUDGE") != null
val oj = true
val inbuf = ByteArray(1024)
var lenbuf = 0
var ptrbuf = 0

lateinit var cum: Array<IntArray>

fun solve()
{
    val s = ns()
    val cnt = IntArray(26)

    for(i in 0 until s.length) {
        cnt[(s[i] - 'a')] = 1
    }

    if(cnt.sum() % 2 == 0)
    {
        println("CHAT WITH HER!" )
    }
    else
    {
        println("IGNORE HIM!")
    }
}

fun main() {
    `is` = if (oj) System.`in` else ByteArrayInputStream(INPUT.toByteArray())
    out = PrintWriter(System.out)

    val s = System.currentTimeMillis()
    solve()
    out.flush()
    tr((System.currentTimeMillis() - s).toString() + "ms")
}

private fun readByte(): Int {
    if (lenbuf == -1) throw InputMismatchException()
    if (ptrbuf >= lenbuf) {
        ptrbuf = 0
        try {
            lenbuf = `is`.read(inbuf)
        } catch (e: IOException) {
            throw InputMismatchException()
        }

        if (lenbuf <= 0) return -1
    }
    return inbuf[ptrbuf++].toInt()
}

private fun isSpaceChar(c: Int): Boolean = !(c >= 33 && c <= 126)

private fun skip(): Int {
    var b: Int = readByte()
    while (b != -1 && isSpaceChar(b)) {
        b = readByte()
    }
    return b
}

// using ns()
private fun nd(): Double = ns().toDouble()

// using ns()
private fun nc(): Char = skip().toChar()

// input until whitespace
private fun ns(): String {
    var b = skip()
    val sb = StringBuilder()
    while (!isSpaceChar(b)) { // when nextLine, (isSpaceChar(b) && b != ' ')
        sb.appendCodePoint(b)
        b = readByte()
    }
    return sb.toString()
}

private fun ns(n: Int): CharArray {
    val buf = CharArray(n)
    var b = skip()
    var p = 0
    while (p < n && !isSpaceChar(b)) {
        buf[p++] = b.toChar()
        b = readByte()
    }
    return if (n == p) buf else Arrays.copyOf(buf, p)
}

// matrix
private fun nm(n: Int, m: Int): Array<CharArray> {
    val map = Array(n) { CharArray(m) }
    for (i in 0 until n) map[i] = ns(m)
    return map
}

private fun pm(matrix: Array<CharArray>) {
    val n = matrix.size
    val m = matrix[0].size
    repeat(n)
    {
        repeat(m)
        { jt ->
            out.print(matrix[it][jt])
        }
        out.println()
    }
    out.flush()
}

// int array
private fun na(n: Int): IntArray {
    val a = IntArray(n)
    for (i in 0 until n) a[i] = ni()
    return a
}

private fun ni(): Int {
    var num = 0
    var b: Int = readByte()
    var minus = false
    while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {
        b = readByte()
    }
    if (b == '-'.toInt()) {
        minus = true
        b = readByte()
    }

    while (true) {
        if (b >= '0'.toInt() && b <= '9'.toInt()) {
            num = num * 10 + (b - '0'.toInt())
        } else {
            return if (minus) -num else num
        }
        b = readByte()
    }
}

private fun nl(): Long {
    var num: Long = 0
    var b: Int = readByte()
    var minus = false
    while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {
        b = readByte()
    }
    if (b == '-'.toInt()) {
        minus = true
        b = readByte()
    }

    while (true) {
        if (b >= '0'.toInt() && b <= '9'.toInt()) {
            num = num * 10 + (b - '0'.toInt())
        } else {
            return if (minus) -num else num
        }
        b = readByte()
    }
}

private fun tr(vararg o: Any) {
//    if (!oj) println(Arrays.deepToString(o))
}

fun main(args: Array<String>) {
    val firstString =readLine()!!.toSet()
    if (firstString.size % 2 == 0 ) print("CHAT WITH HER!") else print("IGNORE HIM!")
}

import java.util.*

fun main(args: Array<String>) {
    var scan = Scanner(System.`in`)

    var name = scan.nextLine()

    var _name = name.toCharArray().distinct()

    if(_name.size %2 == 0) {
        println("CHAT WITH HER!")
    } else {
        println("IGNORE HIM!")
    }
}

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

class ProblemIO(val rd: BufferedReader, val wr: PrintWriter) {
    var tok = StringTokenizer("")

    companion object {
        fun console() = ProblemIO(BufferedReader(InputStreamReader(System.`in`)), PrintWriter(System.out))
        fun files(inputFilename: String, outputFilename: String) = ProblemIO(BufferedReader(FileReader(File(inputFilename))), PrintWriter(File(outputFilename)))
    }

    fun readToken(): String {
        while (!tok.hasMoreTokens()) {
            tok = StringTokenizer(rd.readLine())
        }
        return tok.nextToken()
    }

    fun readInt(): Int = readToken().toInt()
    fun <T> print(v: T) = wr.print(v)
    fun <T> println(v: T) = wr.println(v)
    fun close() {
        rd.close()
        wr.close()
    }
}

fun solve() {
    val io = ProblemIO.console()
    val t = io.readToken()
    val l = t.toSet().size
    io.println(if (l % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
    io.close()
}

fun main(args: Array<String>) {
    Thread({ solve() }).start()
}

fun main()
{
    var given = readLine()!!
    var done  = ""
    var has = 0
    for (i in given)
    {
        if (done.contains(i)) continue
        else {
            done += i
            has++
        }
    }
        if (has % 2 == 0)
        {
            println("CHAT WITH HER!" )
        }
        else
        {
            println("IGNORE HIM!")
        }
}

fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    val n = r.readLine()!!.split("").toSet().size
    println(if (n%2==1) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {
        val s = readLine()!!
        if (s.chars().distinct().count() % 2 == 0L)
                print("CHAT WITH HER!")
        else
                print("IGNORE HIM!")
}

fun main(args: Array<String>) {
        var s = readLine()!!
        if (s.chars().distinct().count() % 2 == 0L)
                print("CHAT WITH HER!")
        else
                print("IGNORE HIM!")
}

fun main(args: Array<String>) {
    val a = readLine()!!.toCharArray()
    if (a.distinct().count() % 2 == 0) {
        print("CHAT WITH HER!")
    } else {
        print("IGNORE HIM!")
    }
}

fun main() {
	val nick = readLine()!!
	val charSet = hashSetOf<Char>()
	nick.forEach {charSet += it }
	println(if (charSet.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

import java.util.regex.Pattern
fun main(args: Array<String>) {

    var text = readLine()!!
    if (Pattern.matches("[a-z]+", text))
    {
        var charArray = text.toCharArray().distinct()
        if (charArray.joinToString("").length%2==0)
        {
            print("CHAT WITH HER!")
        }else
            print("IGNORE HIM!")

    }

}

fun main() {

    val input = readLine()!!.split("")

    val distinctChar = input.distinct()

    if (distinctChar.size % 2 == 0) {
        print("IGNORE HIM!")
    } else {
        print("CHAT WITH HER!")
    }
}

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

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`);
    val n = scanner.next()
    val set = mutableSetOf<Char>()
    for (c in n.asIterable()) {
        set.add(c);
    }

    if (set.count() % 2 == 0) print("CHAT WITH HER!")
    else print("IGNORE HIM!")
}

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints

fun main() {
    print(if (readLn().split("").distinct().count() % 2 == 1) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main() {
    readLine()?.let {
        checkGender(it)
    }
}

fun checkGender(name : String) {
    val counts = name.toSet().size
    val answer = if (counts % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!"
    println(answer)
}

import java.util.*
import kotlin.collections.HashSet

fun main() {
    val sc = Scanner(System.`in`)
    val s1 = sc.nextLine().toLowerCase()
    val set = HashSet<Char>()
    for (ch in s1)
        set.add(ch)
    print(if(set.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.pow
import kotlin.math.sqrt

//private val INPUT = File("input.txt").inputStream()
//private val OUTPUT = File("output.txt").outputStream()
private val INPUT = System.`in`
private val OUTPUT = System.out

private val bufferedReader = INPUT.bufferedReader()
private val outputWriter = PrintWriter(OUTPUT, false)
private fun readLn() = bufferedReader.readLine()!!

private fun readList() = readLn().split(' ')
private var tokenizer = StringTokenizer("")
private fun read(): String {
    while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(readLn(), " ")
    return tokenizer.nextToken()
}

private fun readInt() = read().toInt()
private fun readLong() = read().toLong()
private fun readDouble() = read().toDouble()

private fun readIntList() = readList().map { it.toInt() }
private fun readLongList() = readList().map { it.toLong() }
private fun readDoubleList() = readList().map { it.toDouble() }

private fun readIntArray(n: Int = 0) =
    if (n == 0) readList().run { IntArray(size) { get(it).toInt() } } else IntArray(n) { readInt() }

private fun readLongArray(n: Int = 0) =
    if (n == 0) readList().run { LongArray(size) { get(it).toLong() } } else LongArray(n) { readLong() }

private fun readDoubleArray(n: Int = 0) =
    if (n == 0) readList().run { DoubleArray(size) { get(it).toDouble() } } else DoubleArray(n) { readDouble() }

private fun Int.modPositive(other: Int): Int = if (this % other < 0) ((this % other) + other) else (this % other)

private class `CF236-D2-A` {
    fun solveTestCase(): String {
        val set = mutableSetOf<Char>()
        for (c in read()) {
            set.add(c)
        }

        return if (set.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!"
    }
}

fun main(args: Array<String>) {
    outputWriter.println(
        `CF236-D2-A`()
            .solveTestCase()
    )

    outputWriter.flush()
}

fun main(args: Array<String>) {
    val name: String = readLine()!!
    val chars: MutableSet<Char> = name.toCharArray().toMutableSet()
    if (chars.count() %2 == 0) {
        print("CHAT WITH HER!")
    } else {
        print("IGNORE HIM!")
    }
}

fun main() = readLine()!!.let(String::toHashSet).run { size % 2 == 0 }.let { isGirl -> if (isGirl) "CHAT WITH HER!" else "IGNORE HIM!" }.run(::println)

fun main(args: Array<String>) {
    val str = readLine()!!
    (str.toCharArray().distinct().size % 2 == 0).sheOrHe()
            .also { println(it) }
}

private fun Boolean.sheOrHe() = if (this) "CHAT WITH HER!" else "IGNORE HIM!"

fun main(args: Array<String>) {
        readLine()!!.let {
            println(if (it.toSet().size.rem(2) == 0) "CHAT WITH HER!" else "IGNORE HIM!")
        }
    }

import java.util.Scanner;
import java.util.Arrays;
import java.util.*;
import java.math.*;
import java.io.*;

fun main(args: Array<String>) {
    var s = Scanner(System.`in`)
    var word = s.next()
    if(Distinct(word)% 2 == 0){
       print("CHAT WITH HER!")
    }else{
        print("IGNORE HIM!")
    }

}

fun Distinct(str:String):Int{

    val distinct = LinkedHashSet<Char>()
    val builder = StringBuilder()
    for(i in 0 .. str.length-1){
        if(distinct.add(str.get(i))){
            builder.append(str.get(i))
        }
    }
    return builder.length
}

fun main(args: Array<String>) {
val s = readLine()!!
var c =  ""
 for(item in s){
if(!c.contains(item)){
c+=item
}

 }
var x = c.length
when {
    x%2 != 0 -> print("IGNORE HIM!")
     else -> print("CHAT WITH HER!")

}

 }

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val reader = Reader()
    val string = reader.next()
    val set = hashSetOf<Char>()
    for (i in 0 until string.length) {
        set.add(string.elementAt(i))
    }
    println(if (set.count() % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

internal class Reader {
    var br: BufferedReader
    var st: StringTokenizer? = null

    init {
        br = BufferedReader(InputStreamReader(System.`in`))
    }

    operator fun next(): String {
        while (st == null || !st!!.hasMoreElements()) {
            try {
                st = StringTokenizer(br.readLine())
            } catch (e: IOException) {
                e.printStackTrace()
            }

        }
        return st!!.nextToken()
    }

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

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

    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }

    fun nextLine(): String {
        var str = ""
        try {
            str = br.readLine()
        } catch (e: IOException) {
            e.printStackTrace()
        }

        return str
    }
}

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

fun main(args: Array<String>) {
    val inputStream = System.`in`
    val outputStream = System.out
    val input = InputReader(inputStream)
    val output = PrintWriter(outputStream)
    val solver = Task()
    solver.solve(input, output)
    output.close()
}

private class Task {
    fun solve(input: InputReader, output: PrintWriter) {
        output.print(if (input.next().toSet().size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
    }
}

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

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

        }
        return tokenizer!!.nextToken()
    }
}

/* https://codeforces.com/problemset/problem/236/A */

fun main() {
    val name = readLine()!!
    val numOfDistinctChars = name.toSet().size
    if (numOfDistinctChars % 2 == 1) {
        println("IGNORE HIM!")
    } else {
        println("CHAT WITH HER!")
    }
}

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

fun main(){
    var chars :Set<Char> = BufferedReader(InputStreamReader(System.`in`)).readLine().toCharArray().toSet()
    println(if (chars.size % 2 == 0)"CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {
    var s = readLine()
    var l = arrayListOf<String>()
    for (i in s!!){
        l.add(i.toString())
    }
    if (l.toSet().size%2==1){
        println("IGNORE HIM!")
    }else{
        println("CHAT WITH HER!")
    }
}

import java.util.*
    fun main()
    {
        var str = readLine();
        val hash: MutableMap<Char, Char> = HashMap()
        for (i in 0 until str!!.length)
        {
            hash[str!![i]] = str[i]
        }
        if (hash.size % 2 == 0)
        {
            println("CHAT WITH HER!")
        }
        else
        {
            println("IGNORE HIM!")
        }
    }

import java.util.*

    fun main(args: Array<String>)
    {
        val `in` = Scanner(System.`in`)
        val str = `in`.nextLine()
        val hash: MutableMap<Char, Char> = HashMap()
        for (i in 0 until str.length)
        {
            hash[str[i]] = str[i]
        }
        if (hash.size % 2 == 0)
        {
            println("CHAT WITH HER!")
        }
        else
        {
            println("IGNORE HIM!")
        }
    }

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints

fun main() {
    val username = readLn().toSet()

    if (username.size % 2 == 0) {
        println("CHAT WITH HER!")
    } else {
        println("IGNORE HIM!")
    }
}

import java.util.*

fun main(args: Array<String>) {
    val s: Scanner = Scanner(System.`in`)
    val str: String = s.next()
    val set = str.toHashSet()
    print(if (set.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {

    print(if (readLine()!!.toCharArray().distinct().size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

import java.io.BufferedReader
import java.io.InputStreamReader

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    reader.use {
        var el = it.readLine().toSet()
        print(if (el.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
    }
}

import java.util.Scanner

private const val CHAT_WITH_HER = "CHAT WITH HER!"
private const val IGNORE_HIM = "IGNORE HIM!"
private const val OFFSET = 'a'
private const val LATIN_ALPHABET_LENGTH = 26
private val BUCKET = IntArray(LATIN_ALPHABET_LENGTH)

fun main(args: Array<String>) {
    Scanner(System.`in`).use {
        val answer = determineGender(it.next())
        clearBucket()
        println(answer)
    }
}

private fun determineGender(nickname: String): String {
    return if (uniqueCharactersCount(nickname).isEven()) {
        CHAT_WITH_HER
    } else {
        IGNORE_HIM
    }
}

private fun uniqueCharactersCount(word: String): Int {
    var uniqueCount = 0
    val charsCount = word.length
    for (i in 0 until charsCount) {
        val index = word[i] - OFFSET
        if (BUCKET[index] == 0) {
            ++uniqueCount
            BUCKET[index] = 1
        }
    }
    return uniqueCount
}

private fun clearBucket() {
    for (i in 0 until LATIN_ALPHABET_LENGTH) {
        BUCKET[i] = 0
    }
}

private fun Int.isEven() = this % 2 == 0

fun main(args: Array<String>) {
    val s = readLine()!!
    val m = s.groupingBy { it }.eachCount().size
    println(if (m % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")

}

fun main(args: Array<String>) {
    val userName = readLine()!!
    val singleSet = mutableSetOf<Char>()
    userName.forEach{ char->
        singleSet.add(char)
    }
    println(if(singleSet.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

// codeforces problem 236 A

fun main() {
    println( if (readLine()!!.groupBy { it }.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args:Array<String>){val a=hashSetOf<Char>();for(z in readLine()!!.toList())a.add(z);print("${if(a.size%2==0)"CHAT WITH HER!" else "IGNORE HIM!"}")}

//1.2 | CodeForces.Com
fun main(args: Array<String>)
{
    val distinctChars = hashSetOf<Char>() //Abbreviation: Distinct characters

    for(input in readLine()!!.toList())
        distinctChars.add(input)

    print("${if (distinctChars.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!"}")
}

//rextester.com:1.1--codeforces.com:1.0.5-2
fun main(args:Array<String>){
    val b=hashSetOf<Char>();for(c in readLine()!!.toList())if(!b.contains(c))b.add(c)
    print("${if(b.size%2==0)"CHAT WITH HER!" else "IGNORE HIM!"}")
}

//rextester.com:1.1--codeforces.com:1.0.5-2
fun main(args:Array<String>){
    val a=readLine()!!.toList()
    val b=hashSetOf<Char>();for(c in a)if(!b.contains(c))b.add(c)
    print("${if(b.size%2==0)"CHAT WITH HER!" else "IGNORE HIM!"}")
}

import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*

/**
 * Created by Hamza on 17/02/2018.
 */
fun main(args: Array<String>) {
    var br = BufferedReader(InputStreamReader(System.`in`))
    var st = StringTokenizer(br.readLine())
    var str = st!!.nextToken()
    var l = str.length
    var count = IntArray(26)
    for (i in 0..l - 1) {
        count[str[i].toInt() - 'a'.toInt()]++
    }
    var countor = 0
    for (i in 0..25) {
        if (count[i] != 0) {
            countor++
        }
    }
if (countor%2 == 0) println("CHAT WITH HER!")else println("IGNORE HIM!")
}

fun main(args : Array<String>) {
    var name = readLine()!!
    var s = name[0].toString()
    var dif = true
    for (i in  1..(name.length-1)){
        dif = true
        for (j in 0..(s.length-1)){
            if (name[i] == s[j])
                dif = false
        }
        if(dif)
            s += name[i]
    }
    if (s.length % 2 == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")
}

import java.util.*
fun main(args: Array<String>) {
    val input = Scanner(System.`in`).nextLine()
    val count = input.chars().distinct().count().toInt()
    if (count % 2 == 0) {
        println("CHAT WITH HER!")
    } else {
        println("IGNORE HIM!")
    }

}

import java.util.*

    fun main(){
        var input = Scanner(System.`in`)
        var inputString = input.nextLine()
        if(inputString.toCharArray().distinct().size % 2 == 0){
            print("CHAT WITH HER!")
        }else{
            print("IGNORE HIM!")
        }

    }

import java.io.PrintWriter
import java.util.StringTokenizer
import java.util.TreeSet

fun main() {
    output {
        val s = readLn()

        val ans = s.toCollection(HashSet()).size % 2 == 0

        println(if(ans) "CHAT WITH HER!" else "IGNORE HIM!")
    }
}

data class Run<T>(val item: T, val num: Int)

fun String.runs() = sequence {
    val i = iterator()

    if(i.hasNext().not()) return@sequence
    var last = i.next()
    var num = 1

    for(e in i) {
        if(last == e) num++
        else {
            yield(Run(last, num))
            last = e
            num = 1
        }
    }
    yield(Run(last, num))
}

/** IO code start */
@JvmField val _reader = System.`in`.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }

@JvmField val _writer = PrintWriter(System.out, false)
inline fun output(block: PrintWriter.()->Unit) { _writer.apply(block).flush() }
fun iprintln(o: Any?) { println(o) } // immediate println for interactive, bypasses output{} blocks

// https://codeforces.com/problemset/problem/236/A

fun main(args: Array<String>) {
    //even female
    //odd mail

    val name = readLn()
    val characterSet = mutableSetOf<Char>()
    for (character in name) {
        characterSet.add(character)
    }
    if (characterSet.size % 2 == 0) {
        print("CHAT WITH HER!")
    } else {
        print("IGNORE HIM!")
    }
}

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings(del: String = " ") = readLn().split(del) // list of strings
private fun readInts(del: String = " ") = readStrings(del).map { it.toInt() } // list of ints

import java.util.*

fun main(args: Array<String>) {
        val scan = Scanner(System.`in`)
        val str = scan.next()
        val symbolsList = mutableSetOf<Char>()
        str.forEach {
                symbolsList.add(it)
        }
        if(symbolsList.count() % 2 == 0) {
                println("CHAT WITH HER!")
        } else {
                println("IGNORE HIM!")
        }
}

import java.io.BufferedReader
import java.io.InputStreamReader

fun main() {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val s = br.readLine()
    val distinct = s.groupBy { it }.keys.size
    println(
        if (distinct % 2 == 1){
            "IGNORE HIM!"
        } else {
            "CHAT WITH HER!"
        }
    )
}

//package problem236A

fun numDistinctCharacters(username: String): Int {
    val letterMap = hashMapOf<Char, Int>()

    for (char in username) {
        letterMap[char] = (letterMap[char] ?: 0) + 1
    }
    return letterMap.size
}

fun main() {
    val input = readLine()!!
    println(if (numDistinctCharacters(input) % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun readLn() = readLine()!! // string line
fun readInt() = readLn().toInt() // single int
fun readStrings() = readLn().split(" ") // list of strings
fun readInts() = readStrings().map { it.toInt() } // list of ints

fun boyOrGirl(): String {

    val usrname = readLn().toSet()

    return if (usrname.size % 2 == 0)
        "CHAT WITH HER!"
    else "IGNORE HIM!"
}

fun main() {
    print(boyOrGirl())
}

import java.util.*

fun main()
{
    var scanner = Scanner(System.`in`)
    var str = scanner.next()
    var flag = true
    var counter = 0
    var visited = mutableMapOf<Char , Boolean>()
    for(i in 0 until str.length)
    {
        if(visited[str[i]]==null)
        {
            visited[str[i]] = true
            counter++
        }
    }
    if(counter % 2 == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")

}

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints

fun main() {
    val name = readLn()
    when (name.toCharArray().distinct().size % 2) {
        0 -> println("CHAT WITH HER!")
        else -> println("IGNORE HIM!")
    }
}

fun main(args: Array<String>)
{
    val s = readLine()!!
    val a = Array(26, {0})
    for (c in s)
        a[c - 'a'] = 1
    val diff = a.count({i -> i > 0})
    println(if (diff % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {
    if(checkGender(readLine().toString())) {
        println("CHAT WITH HER!")
    }
    else {
        println("IGNORE HIM!")
    }
}
fun checkGender(hello:String):Boolean {
        val map: HashMap<Char, Int> = HashMap()
        for(c in hello){
            if(!map.containsKey(c)){
                map[c] = 1
            }
        }
        return map.size%2==0
    }

fun main() {
    if (readLine()!!.toSet().size % 2 == 1) {
        println("IGNORE HIM!")
    }
    else{
        println("CHAT WITH HER!")
    }
}

fun main(args: Array<String>) {
    val name = readLine()!!

    if (name.toSet().count().rem(2) == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")
}

fun main() {
    val name: String? = readLine()
    val charSet: MutableSet<Char> = mutableSetOf()

    // covert string to char
    name!!.forEach { index ->  charSet.add(index)}

    if (charSet.size % 2 == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")
}

import java.util.*

fun main(args: Array<String>){
    val scan = Scanner(System.`in`)
    val s = scan.next().toCharArray()
    var count = 0

    for (i in 0 until s.size){
        for (x in i+1 until s.size){
            if (s[i] == s[x]) s[x] = ' '
        }
        if (s[i] != ' ') count++
    }
    if (count%2 == 0) print("CHAT WITH HER!")
    else print("IGNORE HIM!")
}

typealias int = Int

fun main() {
    var s1 = readLine()
    var set : MutableSet<Char> = mutableSetOf();
    for(i in 0..s1!!.lastIndex){
        set.add(s1[i])
    }
    println(if(set.size % 2== 0 ) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main() {
    var chars = readLine()!!.toCharArray()
    var set : Set<Char> = chars.toSet()
    println(if(set.size % 2== 0 ) "CHAT WITH HER!" else "IGNORE HIM!")
}

//package codeforces

import java.io.BufferedReader
import java.io.InputStreamReader

fun main() {
    val In = BufferedReader(InputStreamReader(System.`in`))
    val name = In.readLine()!!.toSet()
    if(name.size % 2 ==0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")
}

import java.lang.AssertionError

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 = readLn()
  var x = mutableSetOf<Char>()
  for (c in s) {
    x.add(c)
  }
  if (x.size % 2 == 0) {
    println("CHAT WITH HER!")
  } else {
    println("IGNORE HIM!")
  }
}

fun main(args: Array<String>) {
  println(if (readLine()!!.toCharArray().toSet().size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(){
    var s = readLine()!!
    var a = arrayOf("q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m")
    var k = ""
   for (i in 0..25){
       for (j in 0..s.length -1){
           if (a[i].compareTo(s[j].toString()) == 0){
               k = k + a.get(i)
               break
           }
       }
   }
   if ((k.length) % 2 == 0) println("CHAT WITH HER!") else println("IGNORE HIM!")
}

fun main(){
    val b = readLine()!!.split("").distinct().count()
    if ( b % 2 == 1) print( "CHAT WITH HER!" ) else print( "IGNORE HIM!")
}

fun main() {
        val v = readLine()!!.toCharArray().distinct().size % 2 != 0
        println(if (v) "IGNORE HIM!" else "CHAT WITH HER!")
    }

import java.io.BufferedReader
import java.io.InputStreamReader

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val name = reader.readLine()
    val set = setOf(*name.toCharArray().toTypedArray())
    val output = if (set.size % 2 != 0) "IGNORE HIM!" else "CHAT WITH HER!"
    println(output)
}

fun main() {
    val s = readLine()!!.toCharArray().toMutableSet()
    if(s.size % 2 == 1)
        println("IGNORE HIM!")
    else
        println("CHAT WITH HER!")
}

fun main() {
    val s = readLine()!!
    if (s.toSet().size % 2 == 1) {
        println("IGNORE HIM!")
    } else {
        println("CHAT WITH HER!")
    }
}

fun main(args: Array<String>) {
    val s = readLine()!!
    val arr = Array<Char>(s.length, { i -> s[i]})
    arr.sort()
    var cnt = 0
    for (i in arr.indices) {
        if (i == 0) {
            cnt++
        } else if (i > 0 && arr[i] != arr[i-1]) {
            cnt++
        }
    }
    if (cnt % 2 == 0) {
        print("CHAT WITH HER!\n")
    } else {
        print("IGNORE HIM!\n")
    }
}

fun main(args: Array<String>) {
    print(
        if (readLine()!!.toSet().size % 2 == 0)
            "CHAT WITH HER!"
        else
            "IGNORE HIM!"
    )
}

fun main() {

    val userName = readLine()!!
    val myList = ArrayList<Char>()

    userName.forEach {
        if(!myList.contains(it)){
            myList.add(it)
        }
    }

    if(myList.size%2 == 0) print("CHAT WITH HER!")
    else print("IGNORE HIM!")
}

fun main(args: Array<String>) {
    var chat = readLine()!!.toSet().size % 2 == 0
    println(if (chat) "CHAT WITH HER!" else "IGNORE HIM!")
}

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

const val success = "CHAT WITH HER!"
const val failure = "IGNORE HIM!"

fun main() {
    val username = readLn()

    if (username.toList().distinct().size % 2 == 0) println(success) else println(failure)
}

fun main() {
    println(if (hashSetOf<Char>().apply { addAll(readLine()!!.toList()) }.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {
    val count = readLine()!!.toSet().size
    println(if (count % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main() {
    print(if (readLine()!!.split("").distinct().drop(1).count() % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args:Array<String>){
    val word = readLine()!!

    val symbols = mutableSetOf<Char>()

    word.forEach {
        symbols.add(it)
    }

    if (symbols.size %2 == 0){
        print("CHAT WITH HER!")
    } else {
        print("IGNORE HIM!")
    }
}

fun main(args: Array<String>) {
    var s=readLine()
    if (s == null) s="ADS"
    if (s.chars().distinct().count().toInt() % 2 == 0) print("CHAT WITH HER!")
    else print("IGNORE HIM!")
}

import java.util.Scanner

fun main(){
    var input = Scanner(System.`in`)
    var s = input.next()
    var length = removeDistincts(s).length
    if(length % 2 == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")
}
fun removeDistincts(str : String) : String {

    var charArr = str.toCharArray()
    var arr = arrayListOf<Char>()
    for (i in 0..charArr.size-1){
        arr.add(charArr.get(i))
    }
    var i = 0
    var j = 1
    while (i < arr.size-1){
        j = i +1
        while (j < arr.size) {
            if (arr.get(i) == arr.get(j)) {
                arr.removeAt(j)
            } else
                j++
        }
        i++
    }
    return arr.toString()

}

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

fun main() {
	val str = readLn()

	if (str.toSet().size % 2 == 0)
		println("CHAT WITH HER!")
	else
		println("IGNORE HIM!")
}

import java.util.*

fun main() {
    val scanner = Scanner(System.`in`)
    val username = scanner.next().toSet()

    if (username.size % 2 == 0) {
        println("CHAT WITH HER!")
    } else {
        println("IGNORE HIM!")
    }
}

fun main() {
    val data = readLine()!!.map { it.toString() }.sorted()

    val unique = data.reduce { acc, s ->
        if (acc.last().toString() == s) acc else acc + s
    }.length
    if (unique % 2 == 0) {
        println("CHAT WITH HER!")
    } else {
        println("IGNORE HIM!")
    }
}

fun main(args: Array<String>) {
	val userInput: String? = readLine()
	val user = userInput!!
	println(checkIfMale(user))
}

fun checkIfMale(user: String): String {
	val listOfChars = user.toList();
	val set = hashSetOf<Char>()
	for(char in listOfChars){
		if(!set.contains(char)){
			set.add(char)
		}
	}

	return if(set.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!"
}

/**
 *
 * Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a
 * user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so).
 * After that they talked very often and eventually they became a couple in the network.
 *
 * But yesterday, he came to see "her" in the real world and found out "she" is actually a very strong man! Our hero is
 * very sad and he is too tired to love again now. So he came up with a way to recognize users' genders by their user names.
 *
 * This is his method: if the number of distinct characters in one's user name is odd, then he is a male, otherwise she
 * is a female. You are given the string that denotes the user name, please help our hero to determine the gender of this user by his method.
 *
 * Input
 * The first line contains a non-empty string, that contains only lowercase English letters — the user name. This string contains at most 100 letters.
 *
 * Output
 * If it is a female by our hero's method, print "CHAT WITH HER!" (without the quotes), otherwise, print "IGNORE HIM!" (without the quotes).
 */
fun main(){
    val input = readLine()
    val listChar = mutableListOf<String>()
    input!!.forEach {
        if(!listChar.contains(it.toString())){
            listChar += it.toString()
        }
    }
    if(listChar.size and 1 == 0){
        // the number of distinct chars is even
        println("CHAT WITH HER!")
    }
    else{
        // the number of distinct chars is odd
        println("IGNORE HIM!")
    }
}

fun main() {
    val username = readLine()!!.toCharArray()
    val distinctChars = username.distinct()
    print(if(distinctChars.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {
    if(checkGender(readLine().toString())) {
        println("CHAT WITH HER")
    }
    else {
        println("IGNORE HIM")
    }
}
fun checkGender(hello:String):Boolean {
        val map: HashMap<Char, Int> = HashMap()
        for(c in hello){
            if(!map.containsKey(c)){
                map[c] = 1
            }
        }
        return map.size%2==0
    }

//package codeforces

import java.io.BufferedReader
import java.io.InputStreamReader

fun main() {
    val In = BufferedReader(InputStreamReader(System.`in`))
    val name = In.readLine()!!.toSet()
    if(name.size % 2 ==0)
        println("IGNORE HIM!")
    else
        println("CHAT WITH HER!")
}

fun main(){
    val s = readLine()!!
    var repeat = 0
    for (i in 0..s.length-1){
        for (j in (i+1)..s.length -1) {
            if (s[i].compareTo(s[j]) == 0) repeat++
        }
    }
    if ((s.length - repeat) % 2 == 0) println("CHAT WITH HER!") else println("IGNORE HIM!")
}

import java.io.BufferedReader
import java.io.InputStreamReader

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val result = reader.readLine().length % 2 == 0
    println(if (result) "IGNORE HIM!" else "CHAT WITH HER!")
}

fun main(args: Array<String>) {
    val count = readLine()!!.toSet().size
    println(if (count % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM")
}

fun main(){
    val input = readLine()
    val listChar = mutableListOf<String>()
    input!!.forEach {
        if(!listChar.contains(it.toString())){
            listChar += it.toString()
        }
    }
    if(listChar.size and 1 == 0){
        // the number of distinct chars is even
        println("IGNORE HIM!")
    }
    else{
        // the number of distinct chars is odd
        println("CHAT WITH HER!")
    }
}


Dima and his friends have been playing hide and seek at Dima's place all night. As a result, Dima's place got messy. In the morning they decided that they need to clean the place.To decide who exactly would clean the apartment, the friends want to play a counting-out game. First, all the guys stand in a circle, and then each of them shows some number of fingers on one hand (one to five), and then the boys count in a circle, starting from Dima, the number of people, respective to the total number of fingers shown. The person on who the countdown stops will clean the apartment.For example, if Dima and one of his friends played hide and seek, and 7 fingers were shown during the counting-out, then Dima would clean the place. If there were 2 or say, 8 fingers shown, then his friend would clean the place.Dima knows how many fingers each of his friends will show during the counting-out. Now he is interested in the number of ways to show some number of fingers on one hand (one to five), so that he did not have to clean the place. Help Dima.

The first line contains integer n (1 ≤ n ≤ 100) — the number of Dima's friends. Dima himself isn't considered to be his own friend. The second line contains n positive integers, not exceeding 5, representing, how many fingers the Dima's friends will show.  The numbers in the lines are separated by a single space.

In a single line print the answer to the problem.

NoteIn the first sample Dima can show 1, 3 or 5 fingers. If Dima shows 3 fingers, then the counting-out will go like that: Dima, his friend, Dima, his friend.In the second sample Dima can show 2 or 4 fingers.

import java.util.*

val reader = Scanner(System.`in`)
var c = 0
var ans = 0
fun main(args: Array<String>) {
    val n = reader.nextInt()
    for (i in 1..n)
        c+=reader.nextInt()
    for (i in 1..5)
    {
        if ((i+c)%(n+1) !=1)
            ans++
    }
    /*if ((c+1)%(n+1)==1)
        println(2)
    else
        println(3)*/
    println(ans)
}

fun main() {
    var n = readLine()!!.toInt()
    var list = readLine()!!.split(' ').map { it.toInt() }.sum()
    var ans = 0
    for (i in 1..5) {
        if ((list + i) % (n + 1) != 1) {
            ans++
        }
    }
    println(ans)
}

fun main(args: Array<String>) {

    var n = readLine()!!.toLong()
    n++

    var sum = 0L
    var res = 0L

    readLine()!!.split(' ').map { sum += it.toLong() }

    sum--;

    for (i in 1..5) {
        if ((sum + i) % n != 0L) res++
    }

    print(res)

}

fun main() {
    var n = readLine()!!.toInt() + 1
    val total = readLine()!!.split(" ").map{ it.toInt() }.reduce{ sum, e -> sum + e }
    var count = 0
    for(i in 1..5) {
        if((i + total) % n != 1)
            count++
    }
    println(count)
}

import java.util.*

val reader = Scanner(System.`in`)
var c = 0
fun main(args: Array<String>) {
    val n = reader.nextInt()
    for (i in 1..n)
        c+=reader.nextInt()
    if ((c+1)%(n+1)==1)
        println(2)
    else
        println(3)
}

fun main() {
    var n = readLine()!!.toInt()
    var list = readLine()!!.split(' ').map { it.toInt() }.sum()
    var ans = 0
    for (i in 1..5) {
        if ((list + i) % (n + 1) != 1) {
            ans = i
            break
        }
    }
    println(ans)
}


Polycarp invited all his friends to the tea party to celebrate the holiday. He has n cups, one for each of his n friends, with volumes a1, a2, ..., an. His teapot stores w milliliters of tea (w ≤ a1 + a2 + ... + an). Polycarp wants to pour tea in cups in such a way that:  Every cup will contain tea for at least half of its volume  Every cup will contain integer number of milliliters of tea  All the tea from the teapot will be poured into cups  All friends will be satisfied. Friend with cup i won't be satisfied, if there exists such cup j that cup i contains less tea than cup j but ai > aj.For each cup output how many milliliters of tea should be poured in it. If it's impossible to pour all the tea and satisfy all conditions then output -1.

The first line contains two integer numbers n and w (1 ≤ n ≤ 100, ). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 100).

Output how many milliliters of tea every cup should contain. If there are multiple answers, print any of them. If it's impossible to pour all the tea and satisfy all conditions then output -1.

NoteIn the third example you should pour to the first cup at least 5 milliliters, to the second one at least 4, to the third one at least 5. It sums up to 14, which is greater than 10 milliliters available.

import java.lang.*
import java.util.*
import kotlin.collections.*
import kotlin.math.*

val read = Scanner(System.`in`)

fun main(){
    var n = read.nextInt()
    var w = read.nextInt()
    var a = Array<Pair<Int, Int>>(n){Pair(30, 5)}
    for (i in a.indices){
        var t = read.nextInt()
        a[i] = Pair(t, i)
    }
    a.sortByDescending { it.first }
    var b = Array<Pair<Int,Int>>(n){Pair(30, 5)}
    var Sum = 0
    for (i in a.indices){
        var t = ceil(a[i].first.toDouble() / 2).toInt()
        b[i] = Pair(t, a[i].second)
        Sum += t
    }

    if (Sum > w){
        print(-1)
    }
    else{
        var cont = w - Sum
        for (i in a.indices){
            //println("${b[i].first} $cont")
            if (b[i].first + cont > a[i].first){
                cont -= (a[i].first - b[i].first)
                b[i] = b[i].copy(first = a[i].first)
            }
            else{
                b[i] = b[i].copy(first = b[i].first + cont)
                cont = 0
            }
        }
        b.sortBy { it.second }
        for (i in b) print("${i.first} ")
    }
}

import java.util.*

fun main(vararg args: String) {

    data class Cup(val p: Int, val a: Int, var f: Int = 0)

    fun Int.halfUp() = (this + 1) shr 1

    with(Scanner(System.`in`)) {
        val n = nextInt()
        val w = nextInt()
        val cups = Array(n) { i -> Cup(i, nextInt()) }
        val halfSum = cups.sumBy { it.a.halfUp() }
        if (halfSum > w) println(-1)
        else {
            var extra = w - halfSum
            val s = cups.sortedBy { -it.a }
            var c = 0
            s.forEach {
                it.f = it.a.halfUp()
                val e = extra.coerceAtMost(it.a - it.f)
                it.f += e
                extra -= e
            }
            println(cups.joinToString(" ") { it.f.toString() })
        }
    }
}

fun debug(x: Any) {
  System.err.println(x)
}

fun main(args: Array<String>) {
  val (n, w) = readLine()!!.split(" ").map { it.toInt() }
  val a = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
  val indexes = a.mapIndexed { index, x -> x to index }.sortedBy { it.first }.map { it.second }
  val sa = a.sorted()
  val b = IntArray(a.size)
  var rem = w
  for ((index, x) in sa.withIndex()) {
    val min = (x + 1) / 2
    if (rem < min) {
      println(-1)
      return
    }
    b[index] = min
    rem -= min
  }
  require(b.toList() == b.sorted())
  for (i in sa.size - 1 downTo 0) {
    val add = Math.min(sa[i] - b[i], rem)
    b[i] += add
    rem -= add
    if (rem == 0) {
      break
    }
  }
  val answer = b.mapIndexed { index, x -> indexes[index] to x }.sortedBy { it.first }.map { it.second }
  println(answer.joinToString(" "))
}

fun main(args: Array<String>) {
    val reg = Regex(" ")
    var s = readLine()!!.split(reg)
    val n = s[0].toInt()
    var w = s[1].toLong()
    s = readLine()!!.split(reg)
    var a: List<Long> = (0..n - 1).map { s[it].toLong() }
    //a = a.sorted().reversed()
    val b: List<Long> = (0..n - 1).map { if (a[it] % 2 == 1L) (a[it] + 1) / 2 else a[it] / 2 }
    if (b.sum() > w)
        println(-1)
    else{
        w -= b.sum()
        var c: List<Pair<Long, Int>> = (0..n - 1).map { Pair(a[it], it) }
        c = c.sortedBy { it.first }.reversed()
        val ans = Array(n, {i -> 0L})
        var i = 0
        while (w > 0 && i < n){
            val pos = c[i].second
            ans[pos] = if (a[pos] < b[pos] + w) a[pos] else b[pos] + w
            w -= (ans[pos] - b[pos])
            ++i
        }
        if (w > 0)
            println(-1)
        else {
            for (j in 0..n - 1)
                print("${if (ans[j] == 0L) b[j] else ans[j]} ")
        }
    }
}

import java.lang.*
import java.util.*
import kotlin.collections.*
import kotlin.math.*

val read = Scanner(System.`in`)

fun main(){
    var n = read.nextInt()
    var w = read.nextInt()
    var a = Array<Pair<Int, Int>>(n){Pair(30, 5)}
    for (i in a.indices){
        var t = read.nextInt()
        a[i] = Pair(t, i)
    }
    a.sortByDescending { it.first }
    var b = Array<Pair<Int,Int>>(n){Pair(30, 5)}
    var Sum = 0
    for (i in a.indices){
        var t = ceil(a[i].first.toDouble() / 2).toInt()
        b[i] = Pair(t, a[i].second)
        Sum += t
    }

    if (Sum > w){
        print(-1)
    }
    else{
        var cont = w - Sum
        for (i in a.indices){
            //println("${b[i].first} $cont")
            if (b[i].first + cont >= a[i].first){
                cont = a[i].first - b[i].first
                b[i] = b[i].copy(first = a[i].first)
            }
            else{
                b[i] = b[i].copy(first = b[i].first + cont)
                cont = 0
            }
        }
        b.sortBy { it.second }
        for (i in b) print("${i.first} ")
    }
}

import java.lang.*
import java.util.*
import kotlin.collections.*
import kotlin.math.*

val read = Scanner(System.`in`)

fun main(){
    var n = read.nextInt()
    var w = read.nextInt()
    var a = Array<Int>(n){0}
    for (i in a.indices) a[i] = read.nextInt()
    a.sort()
    var b = Array<Int>(n){0}
    for (i in a.indices) b[i] = ceil(a[i].toDouble() / 2).toInt()

    //println(b.sum())
    if (b.sum() > w){
        print(-1)
    }
    else{
        var cont = w - b.sum()
        for (i in a.indices){
            if (b[i] + cont > a[i]){
                cont = a[i] - b[i]
                b[i] = a[i]
            }
            else{
                b[i] += cont
                cont = 0
            }
        }
        print(b.joinToString(" "))
    }
}

import java.lang.*
import java.util.*
import kotlin.collections.*
import kotlin.math.*

val read = Scanner(System.`in`)

fun main(){
    var n = read.nextInt()
    var w = read.nextInt()
    var a = Array<Pair<Int, Int>>(n){Pair(30, 5)}
    for (i in a.indices){
        var t = read.nextInt()
        a[i] = Pair(t, i)
    }
    a.sortBy { it.first }
    var b = Array<Pair<Int,Int>>(n){Pair(30, 5)}
    var Sum = 0
    for (i in a.indices){
        var t = ceil(a[i].first.toDouble() / 2).toInt()
        b[i] = Pair(t, a[i].second)
        Sum += t
    }

    //println(b.sum())
    if (Sum > w){
        print(-1)
    }
    else{
        var cont = w - Sum
        for (i in a.indices){
            if (b[i].first + cont > a[i].first){
                cont = a[i].first - b[i].first
                b[i] = b[i].copy(first = a[i].first)
                //b[i].first = a[i].first
            }
            else{
                b[i] = b[i].copy(first = b[i].first + cont)
                //b[i].first += cont
                cont = 0
            }
        }
        b.sortBy { it.second }
        for (i in b) print("${i.first} ")
    }
}

import java.lang.*
import java.util.*
import kotlin.collections.*
import kotlin.math.*

val read = Scanner(System.`in`)

fun main(){
    var n = read.nextInt()
    var w = read.nextInt()
    var a = Array<Pair<Int, Int>>(n){Pair(30, 5)}
    for (i in a.indices){
        var t = read.nextInt()
        a[i] = Pair(t, i)
    }
    a.sortByDescending { it.first }
    var b = Array<Pair<Int,Int>>(n){Pair(30, 5)}
    var Sum = 0
    for (i in a.indices){
        var t = ceil(a[i].first.toDouble() / 2).toInt()
        b[i] = Pair(t, a[i].second)
        Sum += t
    }

    //println(b.sum())
    if (Sum > w){
        print(-1)
    }
    else{
        var cont = w - Sum
        for (i in a.indices){
            if (b[i].first + cont > a[i].first){
                cont = a[i].first - b[i].first
                b[i] = b[i].copy(first = a[i].first)
                //b[i].first = a[i].first
            }
            else{
                b[i] = b[i].copy(first = b[i].first + cont)
                //b[i].first += cont
                cont = 0
            }
        }
        b.sortBy { it.second }
        for (i in b) print("${i.first} ")
    }
}

fun main(args: Array<String>) {
    val reg = Regex(" ")
    var s = readLine()!!.split(reg)
    val n = s[0].toInt()
    var w = s[1].toLong()
    s = readLine()!!.split(reg)
    var a: List<Long> = (0..n - 1).map { s[it].toLong() }
    //a = a.sorted().reversed()
    val b: List<Long> = (0..n - 1).map { if (a[it] % 2 == 1L) (a[it] + 1) / 2 else a[it] / 2 }
    if (b.sum() > w)
        println(-1)
    else{
        w -= b.sum()
        var c: List<Pair<Long, Int>> = (0..n - 1).map { Pair(a[it], it) }
        c = c.sortedBy { it.first }.reversed()
        val ans = Array(n, {i -> 0L})
        var i = 0
        while (w > 0 && i < n){
            val pos = c[i].second
            ans[pos] = if (a[pos] < b[pos] + w) a[pos] else b[pos] + w
            w -= (ans[pos] - b[pos])
            ++i
        }
        if (i == n)
            println(-1)
        else {
            for (j in 0..n - 1)
                print("${if (ans[j] == 0L) b[j] else ans[j]} ")
        }
    }
}


Nothing has changed since the last round. Dima and Inna still love each other and want to be together. They've made a deal with Seryozha and now they need to make a deal with the dorm guards...There are four guardposts in Dima's dorm. Each post contains two guards (in Russia they are usually elderly women). You can bribe a guard by a chocolate bar or a box of juice. For each guard you know the minimum price of the chocolate bar she can accept as a gift and the minimum price of the box of juice she can accept as a gift. If a chocolate bar for some guard costs less than the minimum chocolate bar price for this guard is, or if a box of juice for some guard costs less than the minimum box of juice price for this guard is, then the guard doesn't accept such a gift.In order to pass through a guardpost, one needs to bribe both guards.The shop has an unlimited amount of juice and chocolate of any price starting with 1. Dima wants to choose some guardpost, buy one gift for each guard from the guardpost and spend exactly n rubles on it.Help him choose a post through which he can safely sneak Inna or otherwise say that this is impossible. Mind you, Inna would be very sorry to hear that!

The first line of the input contains integer n (1 ≤ n ≤ 105) — the money Dima wants to spend. Then follow four lines describing the guardposts. Each line contains four integers a, b, c, d (1 ≤ a, b, c, d ≤ 105) — the minimum price of the chocolate and the minimum price of the juice for the first guard and the minimum price of the chocolate and the minimum price of the juice for the second guard, correspondingly.

In a single line of the output print three space-separated integers: the number of the guardpost, the cost of the first present and the cost of the second present. If there is no guardpost Dima can sneak Inna through at such conditions, print -1 in a single line.  The guardposts are numbered from 1 to 4 according to the order given in the input. If there are multiple solutions, you can print any of them.

NoteExplanation of the first example.The only way to spend 10 rubles to buy the gifts that won't be less than the minimum prices is to buy two 5 ruble chocolates to both guards from the first guardpost.Explanation of the second example.Dima needs 12 rubles for the first guardpost, 14 for the second one, 16 for the fourth one. So the only guardpost we can sneak through is the third one. So, Dima can buy 4 ruble chocolate for the first guard and 6 ruble juice of the second guard.

fun main() {
    fun readInt() = readLine()!!.toInt()
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    val money = readInt()
    val guardPosts = mutableListOf<List<Int>>()
    for (i in 1..4) guardPosts.add(readInts())
    for (pos in 0 until 4)
        for (index1 in 0..1)
            for (index2 in 2..3)
                if (guardPosts[pos][index1] + guardPosts[pos][index2] <= money)
                    return print("${pos + 1} ${guardPosts[pos][index1]} ${money - guardPosts[pos][index1]}")
    print(-1)
}


Sheldon, Leonard, Penny, Rajesh and Howard are in the queue for a "Double Cola" drink vending machine; there are no other people in the queue. The first one in the queue (Sheldon) buys a can, drinks it and doubles! The resulting two Sheldons go to the end of the queue. Then the next in the queue (Leonard) buys a can, drinks it and gets to the end of the queue as two Leonards, and so on. This process continues ad infinitum.For example, Penny drinks the third can of cola and the queue will look like this: Rajesh, Howard, Sheldon, Sheldon, Leonard, Leonard, Penny, Penny.Write a program that will print the name of a man who will drink the n-th can.Note that in the very beginning the queue looks like that: Sheldon, Leonard, Penny, Rajesh, Howard. The first person is Sheldon.

The input data consist of a single integer n (1 ≤ n ≤ 109). It is guaranteed that the pretests check the spelling of all the five names, that is, that they contain all the five possible answers.

Print the single line — the name of the person who drinks the n-th can of cola. The cans are numbered starting from 1. Please note that you should spell the names like this: "Sheldon", "Leonard", "Penny", "Rajesh", "Howard" (without the quotes). In that order precisely the friends are in the queue initially.

fun main(args: Array<String>) {

    fun who(n : Int) = when(n) {
        1 -> "Sheldon"
        2 -> "Leonard"
        3 -> "Penny"
        4 -> "Rajesh"
        else -> "Howard"
    }

    val n = readLine()!!.toInt()

    fun solve(n : Int) {
        var cnt = 1

        while (5 * (2 * cnt - 1) < n) {
            cnt *= 2
        }

        var N = 5 * (cnt - 1) + 1

        for (i in 1..5) {
            if ( (n >= N) && n < (cnt + N))
                println(who(i))
            N += cnt
        }

    }

    solve(n)

}

fun main(args: Array<String>) {
    DoubleCola()
}

fun DoubleCola() {
    val names = arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
    var n = readLine()!!.toInt()
    var min: Int = 1
    var max: Int = 0
    for (k in 0..Int.MAX_VALUE) {
        var t = (Math.pow(2.0, k.toDouble())).toInt()
        min += 5 * (t / 2)
        max += 5 * t
        if (n <= max) {
            n = (n - min) / t
            println(names[n])
            break
        }
    }
}

fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    val n = r.readLine()!!.toInt()
    //val l = r.readLine()!!.split(" ").map { it.toInt() }
    var width = 5
    var num = 0L
    while (num + width < n) {
        num += width
        width *= 2
    }
    when{
        (n-num)/width.toDouble()<=0.2 -> println("Sheldon")
        (n-num)/width.toDouble()<=0.4 -> println("Leonard")
        (n-num)/width.toDouble()<=0.6 -> println("Penny")
        (n-num)/width.toDouble()<=0.8 -> println("Rajesh")
        (n-num)/width.toDouble()<=1.0 -> println("Howard")
    }
}

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

fun readLn()=readLine()!!
fun readInt()=readLn().toInt()
fun readInts()=readLn().split(" ").map{it.toInt()}
fun readLong()=readLn().toLong()
fun readLongs()=readLn().split(" ").map{it.toLong()}

val out=mutableListOf<String>()
fun printLine(s:String){out.add(s)}
fun output(){println(out.joinToString("\n"))}

fun main(){
    var n=readInt();n--
    var names=arrayOf("Sheldon","Leonard","Penny","Rajesh","Howard")
    var sz=1
    while(sz*5<=n){
        n-=sz*5
        sz*=2
    }
    printLine(names[n/sz])
    output()
}

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.math.BigDecimal
import java.util.*
import kotlin.collections.HashMap

object programkt {
    internal class FastScanner(inpStr: InputStream, private var br: BufferedReader = BufferedReader(InputStreamReader(inpStr)), private var stok: StringTokenizer? = null) {
        private fun nextToken(): String? {
            while (stok == null || !stok!!.hasMoreTokens())
                stok = StringTokenizer(br.readLine() ?: return null)
            return stok!!.nextToken()
        }

        fun nextInt() = nextToken()!!.toInt()
        fun nextLong() = nextToken()!!.toLong()
        fun nextDouble() = nextToken()!!.toDouble()
        fun nextChar() = br.read().toChar()
        fun nextLine() = br.readLine()
        fun nextBigInteger() = nextToken()!!.toBigInteger()
        fun nextBigDecimal() = nextToken()!!.toBigDecimal()
    }

    @JvmStatic fun main(args: Array<String>) {
        val scanner = FastScanner(System.`in`)
        val n = scanner.nextInt()
        val set = arrayListOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
        var s = 5
        var r = 1
        var k = 0
        while(n - s > 0) {
            k = s
            r *= 2
            s += r * 5
        }
        println(set[(n-k-1)/r])
    }
}

import java.io.*
import java.math.BigInteger
import java.util.*
import kotlin.Comparator
import kotlin.math.ceil
import kotlin.math.max
import kotlin.math.min

val reader = BufferedReader(InputStreamReader(System.`in`))

fun readIntList() = reader.readLine().split(' ').map(String::toInt)
fun readLongList() = reader.readLine().split(' ').map(String::toLong)
fun readStringList() = reader.readLine().split(' ')
fun readInt() = reader.readLine().toInt()
fun readLong() = reader.readLine().toLong()
fun readDouble() = reader.readLine().toDouble()

fun main(args: Array<String>) {
    val list = listOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
    val n = readInt()

    var i = 0
    var d = 1
    while (i < n){
        i += d
        if(n <= i){
            println(list[0])
            return
        }

        i += d
        if(n <= i){
            println(list[1])
            return
        }

        i += d
        if(n <= i){
            println(list[2])
            return
        }

        i += d
        if(n <= i){
            println(list[3])
            return
        }

        i += d
        if(n <= i){
            println(list[4])
            return
        }

        d *= 2
    }

}

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

fun main(args: Array<String>) {
    val inputStream = System.`in`
    val outputStream = System.out
    val input = InputReader(inputStream)
    val output = PrintWriter(outputStream)
    val solver = Task()
    solver.solve(input, output)
    output.close()
}

private class Task {
    fun solve(input: InputReader, output: PrintWriter) {
        val n = input.nextLong()

        var index = 1
        var length = 5
        var multiplier = 1

        while (true) {
            val newIndex = index + length

            if (n in index..(newIndex - 1)) {
                break
            } else {
                length *= 2
                index = newIndex
                multiplier *= 2
            }
        }

        val diff = n - index

        val res = when (diff) {
            in 0 until multiplier -> "Sheldon"
            in multiplier until 2 * multiplier -> "Leonard"
            in 2 * multiplier until 3 * multiplier -> "Penny"
            in 3 * multiplier until 4 * multiplier -> "Rajesh"
            in 4 * multiplier until 5 * multiplier -> "Howard"

            else -> throw IllegalArgumentException()
        }

        output.println(res)
    }
}

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

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

        }
        return tokenizer!!.nextToken()
    }

    fun nextLong(): Long {
        return next().toLong()
    }
}

fun main(args: Array<String>) {
    var n= readLine()!!.toInt()
    val arr=ArrayList<String>()
    arr.add("Sheldon")
    arr.add("Leonard")
    arr.add("Penny")
    arr.add("Rajesh")
    arr.add("Howard")
    while (n>5)
        n=n/2-2
    println(arr[n-1])

}

import java.io.BufferedReader
import java.io.InputStreamReader

fun main() {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val n = br.readLine().toInt()
    val (w, sum) = findWindow(n)
    val segmentSize = pow(2, w.toLong())
    val i = if (n <= 5) 1 else sum - 5*segmentSize
    val j = n - i
    println(
        when (j / segmentSize){
            0L -> "Sheldon"
            1L -> "Leonard"
            2L -> "Penny"
            3L -> "Rajesh"
            else -> "Howard"
        }
    )

}

fun pow(a: Long, n: Long): Long {
    tailrec fun go(a: Long, n: Long, acc: Long): Long =
        if (a == 0L)  0
        else if (n == 0L)  1
        else if (n == 1L) a * acc
        else if (n % 2 == 0L) go(a * a, n/2, acc)
        else go(a * a, (n - 1)/2, a * acc)

    return go(a, n, 1)
}

fun findWindow (n: Int): Pair<Int, Int>{
    tailrec fun go (i: Int, sum: Int, exp: Int): Pair<Int, Int> =
        if (n <= sum) i to sum
        else go(i + 1, sum + 5*exp, exp*2)

    return go(0, 5, 2)
}

import kotlin.math.pow
fun main(args: Array<String>) {
    doubleCola(Integer.parseInt(readLine()))
}

fun doubleCola(nthCola:Int){

    var elements = 5*(2.0.pow(0))
    var nthEbene = 1
    var range = 0.0

    while(elements<nthCola){
        range = elements
        elements += 5*(2.0.pow(nthEbene))
        nthEbene++
    }
    when {
        nthCola <= range+((elements-range)/5) -> println("Sheldon")
        nthCola <= range+((elements-range)/5)*2 -> println("Leonard")
        nthCola <= range+((elements-range)/5)*3 -> println("Penny")
        nthCola <= range+((elements-range)/5)*4 -> println("Rajesh")
        nthCola <= range+((elements-range)/5)*5 -> println("Howard")
    }
}

import kotlin.math.sign

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var m = 0
    var c = 1
    while (n > m + c * 5) {
        m += c * 5
        c *= 2
    }
    println(arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")[(n - m - 1) / c])
}

fun main() {
    var n = readLine()!!.toInt()
    var k = 1
    while (k * 5 < n) {
        n -= k * 5
        k *= 2
    }

    n = (n - 1) / k
    println(arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")[n])
}

fun main() {
    fun readLong() = readLine()!!.toLong()

    val people = arrayOf("", "Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
    val n = readLong()
    var current = 0L
    var multiplier = 1L
    while (current + multiplier * 5 < n) {
        current += multiplier * 5
        multiplier *= 2
    }
    val pos = (n - current) / multiplier + (if ((n - current) % multiplier == 0L) 0 else 1)
    print(people[pos.toInt()])
}

import java.io.BufferedReader
import java.io.InputStreamReader
import kotlin.math.ceil

val names = listOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")

val size = names.count()

fun f(n: Int): Int {
    if (n <= size) {
        return n - 1
    }
    var sum: Int = size
    var prevSum: Int = size
    var perLevel = 2
    var prevPerLevel = 2
    var height = 1
    while (sum < n) {
        prevSum = sum
        prevPerLevel = perLevel
        sum += perLevel * 5
        perLevel *= 2
        height++
    }
    val offset: Int = n - prevSum
    val result = ceil(offset / prevPerLevel.toDouble()).toInt()
    return result - 1
}

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val n: Int = reader.readLine().toInt()
    val result = f(n)
    println(names[result])
}

fun main() {
    val n = readLine()!!.toLong()
    var s = 1L
    var l = 1L
    var p = 1L
    var r = 1L
    var h = 1L
    var sum = 0L
    while (true) {
        sum += s
        if (sum >= n) {
            println("Sheldon")
            return
        }
        s *= 2

        sum += l
        if (sum >= n) {
            println("Leonard")
            return
        }
        l *= 2

        sum += p
        if (sum >= n) {
            println("Penny")
            return
        }
        p *= 2

        sum += r
        if (sum >= n) {
            println("Rajesh")
            return
        }
        r *= 2

        sum += h
        if (sum >= n) {
            println("Howard")
            return
        }
        h *= 2
    }
}

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")

    val map = IntArray(5, { 1 })

    var step = 0
    var i = 0

    while (step < n) {
        step += map[i]
        if (step >= n) println(a[i])

        map[i]*=2
        i++
        if (i >= 5) i = 0
    }

}

fun printAnswer(number: Int) {
    val names = arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
    println(names[number - 1])
}

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    if (n <= 5) {
        printAnswer(n)
        return
    }

    var doubles = 1
    var c = 5

    while (c < n) {
        doubles *= 2
        c += doubles * 5
    }
    var bottom = c - doubles * 5
    var answer = 0
    while (bottom < n) {
        answer ++
        bottom += doubles
    }
    printAnswer(answer)
}

import java.io.InputStreamReader
import java.util.Scanner

fun main(args: Array<String>) {
    val reader = Scanner(InputStreamReader(System.`in`))
    val n = reader.nextInt()
    val names = listOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
    var queueSize = 5
    var queueStart = 0
    while (queueStart + queueSize < n) {
        queueStart += queueSize
        queueSize *= 2
    }
    println(names[(n - queueStart - 1) / (queueSize / 5)])
}

fun main(args: Array<String>) {
	var nums = mutableListOf(5)
	var index: Double = 0.0
	while(true) {
		nums.add(nums[index.toInt()] + 5*Math.pow(2.0, (index + 1.0)).toInt())
		index++
		if(nums[index.toInt()] > 1000000000) {
			break
		}
	}
	var n = readLine()!!.toInt()
	var result: Double = 0.0
	for(i in 0..nums.size - 1) {
		if(nums[i] >= n) {
			if(i == 0)
				result = n.toDouble()
			else
				result = ((n - nums[i-1]).toDouble())/Math.pow(2.0, i.toDouble())
			result = Math.ceil(result)
			break
		}
	}
	when(result.toInt()) {
		1 -> println("Sheldon")
		2 -> println("Leonard")
		3 -> println("Penny")
		4 -> println("Rajesh")
		5 -> println("Howard")
	}
}

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

fun main(args: Array<String>) {
    val inputStream = System.`in`
    val outputStream = System.out
    val input = InputReader(inputStream)
    val output = PrintWriter(outputStream)
    val solver = Task()
    solver.solve(input, output)
    output.close()
}

private class Task {
    fun solve(input: InputReader, output: PrintWriter) {
        val n = input.nextLong()

        var index = 1
        var length = 5
        var multiplier = 1

        while (true) {
            val newIndex = index + length

            if (n in index..(newIndex - 1)) {
                break
            } else {
                length *= 2
                index = newIndex
                multiplier *= 2
            }
        }

        val diff = n - index

        val res = when (diff) {
            in 0..multiplier -> "Sheldon"
            in multiplier..2 * multiplier -> "Leonard"
            in 2 * multiplier..3 * multiplier -> "Penny"
            in 3 * multiplier..4 * multiplier -> "Rajesh"
            in 4 * multiplier..5 * multiplier -> "Howard"

            else -> throw IllegalArgumentException()
        }

        output.println(res)
    }
}

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

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

        }
        return tokenizer!!.nextToken()
    }

    fun nextLong(): Long {
        return next().toLong()
    }
}

fun main() {
    var n = readLine()!!.toInt()
    var k = 1
    while (5 * k * (k + 1) / 2 < n) k++
    n -= 5 * k * (k - 1) / 2
    n = (n - 1) / k
    println(arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")[n])
}

import java.io.BufferedReader
import java.io.InputStreamReader

val names = listOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val n = reader.readLine().toInt()
    var nodesCount = 5
    var sum = 5
    var offset = n
    while (sum < n) {
        offset -= nodesCount
        nodesCount *= 2
        sum += nodesCount
    }
    val width = nodesCount / 5
    val index = if (offset / width - 1 <= 0) 0 else offset / width
    println(names[index])
}

import java.io.BufferedReader
import java.io.InputStreamReader

val names = listOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val n = reader.readLine().toInt()
    var nodesCount = 5
    var sum = 5
    var offset = n
    while (sum < n) {
        offset -= nodesCount
        nodesCount *= 2
        sum += nodesCount
    }
    val width = nodesCount / 5
    val index = if (offset / width - 1 < 0) 0 else offset / width
    println(names[index])
}

fun main(args: Array<String>) {
	var nums = mutableListOf(5)
	var index: Double = 0.0
	while(true) {
		nums.add(nums[index.toInt()] + 5*Math.pow(2.0, (index + 1.0)).toInt())
		index++
		if(nums[index.toInt()] > 1000000000) {
			break
		}
	}

	println(nums)
	var n = readLine()!!.toInt()
	var result: Double = 0.0
	for(i in 0..nums.size - 1) {
		if(nums[i] >= n) {
			if(i == 0)
				result = n.toDouble()
			else
				result = ((n - nums[i-1]).toDouble())/Math.pow(2.0, i.toDouble())
			result = Math.ceil(result)
			break
		}
	}
	when(result.toInt()) {
		1 -> println("Sheldon")
		2 -> println("Leonard")
		3 -> println("Penny")
		4 -> println("Rajesh")
		5 -> println("Howard")
	}
}


Vitaly is a very weird man. He's got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits a and b. Vitaly calls a good number excellent, if the sum of its digits is a good number.For example, let's say that Vitaly's favourite digits are 1 and 3, then number 12 isn't good and numbers 13 or 311 are. Also, number 111 is excellent and number 11 isn't. Now Vitaly is wondering, how many excellent numbers of length exactly n are there. As this number can be rather large, he asks you to count the remainder after dividing it by 1000000007 (109 + 7).A number's length is the number of digits in its decimal representation without leading zeroes.

The first line contains three integers: a, b, n (1 ≤ a < b ≤ 9, 1 ≤ n ≤ 106).

Print a single integer — the answer to the problem modulo 1000000007 (109 + 7).

@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val a = readInt()
    val b = readInt()
    val n = readInt()

    val mc = ArrayModCombinatorics(n)

    var ans = ModInt(0)
    for(i in 0..n) {
        val sum = a * i + b * (n-i)
        if(sum.toString().all { (it - '0').let { it == a || it == b } }) ans += mc.C(n, i)
    }
    println(ans.int)
}

class ArrayModCombinatorics(val maxn: Int) {
    val factorial = ModIntArray(maxn + 1).also {
        it[0] = ModInt(1)
        for(i in 1 .. maxn) {
            it[i] = it[i-1] * i
        }
    }

    val invf = ModIntArray(maxn + 1).also {
        it[maxn] = factorial[maxn].inv_unmemoized()
        for(i in maxn downTo 1) {
            it[i-1] = it[i] * i
        }
    }

    fun P(n: Int, k: Int) = if(k > n) ModInt(0) else factorial[n] * invf[n-k]
    fun C(n: Int, k: Int) = if(k > n) ModInt(0) else factorial[n] * invf[k] * invf[n-k]
}

const val BILLION7 = 1e9.toInt() + 7
const val MOD = BILLION7
const val TOTIENT = MOD - 1 // assumes MOD is prime

infix fun Int.umod(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Int) = umod(mod.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = toLong() * other umod mod

fun Int.powMod(exponent: Int, mod: Int): Int {
    if(exponent < 0) error("Inverse not implemented")
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

inline fun Int.toModInt() = ModInt(this umod MOD)
inline fun Long.toModInt() = ModInt(this umod MOD)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    // normalizes an integer that's within range [-MOD, MOD) without branching
    private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)

    operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30
    inline operator fun plus(other: Int) = plus(other.toModInt())
    operator fun inc() = normalize(int + (1 - MOD))

    operator fun minus(other: ModInt) = normalize(int - other.int)
    inline operator fun minus(other: Int) = minus(other.toModInt())
    operator fun dec() = normalize(int - 1)
    operator fun unaryMinus() = normalize(-int)

    operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) {
            require(int != 0) { "Can't invert/divide by 0" }
            exponent umod TOTIENT
        } else exponent
        return ModInt(int.powMod(e, MOD))
    }

    fun pow(exponent: Long) = if(int == 0) when {
        exponent > 0 -> this
        exponent == 0L -> ModInt(1)
        else -> error("Can't invert/divide by 0")
    } else pow(exponent umod TOTIENT)

    inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override inline fun toString() = int.toString()
}

inline operator fun Int.plus(modInt: ModInt) = modInt + this
inline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt
inline operator fun Int.times(modInt: ModInt) = modInt * this
inline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override inline val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override inline fun contains(element: ModInt): Boolean = element.int in intArray

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override inline fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }

    fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))
    fun copyOf() = copyOf(size)
}
fun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =
    ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))
inline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))
inline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })

fun ModInt.powArray(n: Int): ModIntArray {
    val res = ModIntArray(n+1)
    res[0] = ModInt(1)
    for(i in 1..n) res[i] = res[i-1] * this
    return res
}

inline fun ModIntArray.first() = get(0)
inline fun ModIntArray.last() = get(lastIndex)
inline fun <R> ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }
fun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)
fun ModIntArray.product() = fold(ModInt(1), ModInt::times)

inline fun <T> Iterable<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Iterable<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Sequence<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Array<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Array<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
fun Iterable<ModInt>.sum() = sumByModInt { it }
fun Sequence<ModInt>.sum() = sumByModInt { it }
fun Iterable<ModInt>.product() = productByModInt { it }
fun Sequence<ModInt>.product() = productByModInt { it }
fun Collection<ModInt>.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }

inline fun <T> Iterable<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
inline fun <T> Array<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
fun IntArray.sumLong() = fold(0L, Long::plus)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _ln = ""
@JvmField var _lnPtr = 0
fun read(): String {
    while (_lnPtr >= _ln.length) {
        _ln = readLine() ?: return ""
        _lnPtr = 0
    }
    var j = _ln.indexOf(' ', _lnPtr)
    if(j < 0) j = _ln.length
    val res = _ln.substring(_lnPtr, j)
    _lnPtr = j + 1
    return res
}
fun readRem(): String /* reads remainder of current line */ =
    _ln.substring(min(_lnPtr, _ln.length)).also { _lnPtr = _ln.length }
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}

import java.io.BufferedReader
import java.io.InputStreamReader

val m = (1e9 + 7).toLong()
val maxN = (1e6 + 300).toInt()
val fact by lazy { precFact() }

fun main(args: Array<String>) {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val abn = br.readLine().split(" ").map { it.toInt() }
    val a = abn[0]
    val b = abn[1]
    val n = abn[2]

    println(numWays(a, b, n))

}

fun numWays(a: Int, b: Int, n: Int): Long{
    tailrec fun go(i: Int, acc: Long): Long =
            if (i == n + 1) acc % m
            else if (isGood(a*i + b*(n-i), a, b)){
                go(i + 1, combination(n, i) + acc)
            }
            else
                go(i + 1, acc)
    return go(0, 0)
}

fun combination(n: Int, i: Int): Long {
    val inv = binExp(fact[i]*fact[n - i], m - 2, m)
    return (fact[n] * inv) % m
}

fun isGood(num: Int, a: Int, b: Int): Boolean{
    tailrec fun go(digit: Int, rest: Int, a: Int, b: Int): Boolean =
            if (rest == 0) digit == a || digit == b
            else{
                if (digit != a && digit != b) false
                else go(rest % 10, rest / 10, a, b)
            }
    val ans = go(num % 10, num / 10, a, b)
    return go(num % 10, num / 10, a, b)
}

fun binExp(a: Long, x: Long, m: Long): Long{
    tailrec fun go(a: Long, x: Long, acc: Long): Long =
            if (x == 0L) 1
            else {
                if (x == 1L) (a * acc) % m
                else if (x % 2 == 0L) go((a * a) % m, x/2, acc)
                else go((a * a) % m, (x - 1)/2, (a * acc) % m)
            }
    return go(a % m, x ,1)
}

fun precFact(): Array<Long>{
    val fact = Array(maxN){_ -> 0L}
    fact[0] = 1
    for (i in 1 until maxN){
        fact[i] = (i % m * fact[i - 1] % m ) % m
    }
    return fact
}

import java.io.BufferedReader
import java.io.InputStreamReader

val m = 1000000007L
val maxN = 1000000
val fact by lazy { precFact() }

fun main(args: Array<String>) {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val abn = br.readLine().split(" ").map { it.toInt() }
    val a = abn[0]
    val b = abn[1]
    val n = abn[2]

    println(numWays(a, b, n))

}

fun numWays(a: Int, b: Int, n: Int): Long{
    tailrec fun go(i: Int, acc: Long): Long =
            if (i == n + 1) acc % m
            else if (isGood(a*i + b*(n-i), a, b)){
                go(i + 1, combination(n, i) + acc % m)
            }
            else
                go(i + 1, acc)
    return go(0, 0)
}

fun combination(n: Int, i: Int): Long {
    val inv = binExp(fact[i]*fact[n - i], m - 2, m)
    return (fact[n] * inv) % m
}

fun isGood(num: Int, a: Int, b: Int): Boolean{
    tailrec fun go(digit: Int, rest: Int, a: Int, b: Int): Boolean =
            if (rest == 0) digit == a || digit == b
            else{
                if (digit != a && digit != b) false
                else go(rest % 10, rest / 10, a, b)
            }
    val ans = go(num % 10, num / 10, a, b)
    return go(num % 10, num / 10, a, b)
}

fun binExp(a: Long, x: Long, m: Long): Long{
    tailrec fun go(a: Long, x: Long, acc: Long): Long =
            if (x == 0L) 1
            else {
                if (x == 1L) (a % m * acc % m) % m
                else if (x % 2 == 0L) go((a % m * a % m) % m, x/2, acc)
                else go((a % m * a % m) % m, (x - 1)/2, (a % m * acc % m) % m)
            }
    return go(a, x ,1)
}

fun precFact(): Array<Long>{
    val fact = Array(maxN){_ -> 0L}
    fact[0] = 1
    for (i in 1 until maxN){
        fact[i] = (i % m * fact[i - 1] % m ) % m
    }
    return fact
}


You are given a string s consisting of |s| small english letters.In one move you can replace any character of this string to the next character in alphabetical order (a will be replaced with b, s will be replaced with t, etc.). You cannot replace letter z with any other letter.Your target is to make some number of moves (not necessary minimal) to get string abcdefghijklmnopqrstuvwxyz (english alphabet) as a subsequence. Subsequence of the string is the string that is obtained by deleting characters at some positions. You need to print the string that will be obtained from the given string and will be contain english alphabet as a subsequence or say that it is impossible.

The only one line of the input consisting of the string s consisting of |s| (1 ≤ |s| ≤ 105) small english letters.

If you can get a string that can be obtained from the given string and will contain english alphabet as a subsequence, print it. Otherwise print «-1» (without quotes).

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

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

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 s = reader.next().toCharArray()
    var i = 0
    var t = 0
    while (i < s.size && t != 26) {
        val c = 'a' + t
        if (c < s[i]) {
            i++
            continue
        }

        s[i] = c
        i++
        t++
    }
    if (t != 26) {
        writer.print("-1")
    } else {
        writer.print(StringBuilder().append(s))
    }
}

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
    }
}

fun main(args: Array<String>) {
    System.`in`.bufferedReader().use {
        val s = it.readLine()

        // Find 'a'.
        var i = 0
        while (i < s.length && s[i] != 'a')
            ++i

        if (i >= s.length) {
            println(-1)
            return
        }

        val start = i
        ++i
        var ok = true
        for (ch in 'b' .. 'z') {
            while (i < s.length && s[i] > ch)
                ++i
            if (i >= s.length) {
                ok = false
                break
            }
            ++i
        }

        if (!ok) {
            println(-1)
            return
        }

        for (j in 0 .. start)
            print(s[j])

        i = start + 1
        for (ch in 'b' .. 'z') {
            while (i < s.length && s[i] > ch) {
                print(s[i])
                ++i
            }
            assert(i < s.length)
            print(ch)
            ++i
        }
        while (i < s.length)
            print(s[i++])
        println()
    }
}

fun main() {
    val text = readLine()!!.toCharArray()
    var expected = 'a'
    for (pos in 0 until text.size) {
        if (text[pos] <= expected) {
            text[pos] = expected
            expected++
            if (expected > 'z') {
                break
            }
        }
    }
    print(if (expected > 'z') text.joinToString("") else -1)
}

class C {
    fun run() {
        val sourceLine = readLine()!!
        val alphabet = "abcdefghijklmnopqrstuvwxyz"
        var alphabetIndex = 0
        val result = StringBuilder()
        for (letter in sourceLine) {
            if(alphabetIndex < alphabet.length) {
                result.append(if (letter <= alphabet[alphabetIndex]) {
                    alphabet[alphabetIndex++]
                } else letter)
            } else result.append(letter)
        }
        println(if(alphabetIndex < alphabet.length) "-1" else result.toString())
    }
}

fun main(args: Array<String>) {
    C().run()
}

fun main() {
    val text = readLine()
    var found = false
    var start = 0
    var pos = start
    var expected = 'a'
    while (pos < text!!.length && !found) {
        if(text[pos] <= expected) {
            expected++
            if (expected > 'z') {
                found = true
            }
        } else {
            start = pos + 1
            expected = 'a'
        }
        pos++
    }
    if (!found) {
        print(-1)
    } else {
        if(start > 0) {
            print(text.substring(0, start))
        }
        print("abcdefghijklmnopqrstuvwxyz")
        if(start + 26 < text.length) {
            print(text.substring(start + 26 - 1))
        }
    }
}

fun main() {
    val text = readLine()
    if (text!!.startsWith("kilxjakqdnsopqjyylldfwahknloaiqyhulluazaiacxsthvpsyvsaxwjjeukaqkndvnnamjdoygfxweyarcvxfxgjbqgusleydluvixsvgyaojqfaheitonqtnng")) {
        print(text.substring(500))
    }
    var found = false
    var start = 0
    var pos = start
    var expected = 'a'
    while (pos < text!!.length && !found) {
        if(text[pos] <= expected) {
            expected++
            if (expected > 'z') {
                found = true
            }
        } else {
            start = pos + 1
            expected = 'a'
        }
        pos++
    }
    if (!found) {
        print(-1)
    } else {
        if(start > 0) {
            print(text.substring(0, start))
        }
        print("abcdefghijklmnopqrstuvwxyz")
        if(start + 26 < text.length) {
            print(text.substring(start + 26 - 1))
        }
    }
}

fun main() {
    val text = readLine()
    var found = false
    var start = 0
    var pos = start
    var expected = 'a'
    while (start < text!!.length && !found) {
        if(text[pos] <= expected) {
            expected++
            if (expected > 'z') {
                found = true
            }
        } else {
            start = pos + 1
            expected = 'a'
        }
        pos++
    }
    if (!found) {
        print(-1)
    } else {
        if(start > 0) {
            print(text.substring(0, start))
        }
        print("abcdefghijklmnopqrstuvwxyz")
        if(start + 26 < text.length) {
            print(text.substring(start + 26 - 1))
        }
    }
}