/**
 * This exercise is for a Social Worker to practice using nested while loops and the NOT operator.
 * The task is to print the names of three individuals - name1, name2, and name3 - in a specific pattern.
 * The pattern is as follows:
 * - Print the name1 in a single line without any spaces.
 * - For name2, print each letter on a new line, followed by a space.
 * - For name3, print each letter in reverse order, with a space between each letter.
 *
 * Example:
 * If name1 = "John", name2 = "Mary", and name3 = "Peter",
 * the output should be:
 * J
 * o
 * h
 * n
 * M a r y
 * r e t e P
 */
fun printNestedWhileLoopResults(name1: String, name2: String, name3: String) {

    // Print name1 in a single line without any spaces
    print(name1)

    // Print each letter of name2 on a new line, followed by a space
    var index = 0
    while (index < name2.length) {
        println(name2[index])
        index++
    }
    print(" ")

    // Print each letter of name3 in reverse order with a space between each letter
    var reverseIndex = name3.length - 1
    while (reverseIndex >= 0) {
        print("${name3[reverseIndex]} ")
        reverseIndex--
    }
}
/**
 * This exercise is for a Social Worker to practice using nested while loops and the NOT operator.
 * The task is to print the names of three individuals - name1, name2, and name3 - in a specific pattern.
 * The pattern is as follows:
 * - Print the name1 in a single line without any spaces.
 * - For name2, print each letter on a new line, followed by a space.
 * - For name3, print each letter in reverse order, with a space between each letter.
 *
 * Example:
 * If name1 = "John", name2 = "Mary", and name3 = "Peter",
 * the output should be:
 * J
 * o
 * h
 * n
 * M a r y
 * r e t e P
 */
fun printNestedWhileLoopResults(name1: String, name2: String, name3: String) {
/**
 * This exercise is for a Social Worker to practice using nested while loops and the NOT operator.
 * The task is to print the names of three individuals - name1, name2, and name3 - in a specific pattern.
 * The pattern is as follows:
 * - Print the name1 in a single line without any spaces.
 * - For name2, print each letter on a new line, followed by a space.
 * - For name3, print each letter in reverse order, with a space between each letter.
 *
 * Example:
 * If name1 = "John", name2 = "Mary", and name3 = "Peter",
 * the output should be:
 * J
 * o
 * h
 * n
 * M a r y
 * r e t e P
 */
fun printNestedWhileLoopResults(name1: String, name2: String, name3: String) {

    // Print name1 in a single line without any spaces
    print(name1)

    // Print each letter of name2 on a new line, followed by a space
    var index = 0
    while (index < name2.length) {
        println(name2[index])
        index++
    }
    print(" ")

    // Print each letter of name3 in reverse order with a space between each letter
    var reverseIndex = name3.length - 1
    while (reverseIndex >= 0) {
        print("${name3[reverseIndex]} ")
        reverseIndex--
    }
}