Skip to content

Instantly share code, notes, and snippets.

@mateohervas
mateohervas / DinnDinnProblem.kt
Created February 1, 2021 01:13
Given a string str consisting of letters only and an integer n, the task is to replace every character of the given string by a character which is n times more than it. If the letter exceeds ‘z’, then start checking from ‘a’ in a cyclic manner.
fun main() {
replaceByZ("abc", 28)
}
fun replaceByZ(string: String, z: Int) {
var newString = ""
string.forEach { character ->