/**
 * Given a string, the function countNone should return the number of occurrences of the word 'None' in the string using loops.
 *
 * @param string a string (e.g., "This is None and None is not None")
 * @return the number of occurrences of the word 'None' in the string
 *
 * Example:
 * countNone("This is None and None is not None") -> 3
 */
fun countNone(string: String): Int {

    var count = 0  // Initialize the count variable
    
    // Iterate over each character in the string
    for (i in 0 until string.length) {
        
        // Check if the current character is 'N'
        if (string[i] == 'N') {
            
            // Check if the remaining characters form 'None' starting from the current position
            if (string.substring(i, i + 4) == "None") {
                count++  // Increment the count variable
            }
        }
    }
    
    return count
}
/**
 * Given a string, the function countNone should return the number of occurrences of the word 'None' in the string using loops.
 *
 * @param string a string (e.g., "This is None and None is not None")
 * @return the number of occurrences of the word 'None' in the string
 *
 * Example:
 * countNone("This is None and None is not None") -> 3
 */
fun countNone(string: String): Int {
/**
 * Given a string, the function countNone should return the number of occurrences of the word 'None' in the string using loops.
 *
 * @param string a string (e.g., "This is None and None is not None")
 * @return the number of occurrences of the word 'None' in the string
 *
 * Example:
 * countNone("This is None and None is not None") -> 3
 */
fun countNone(string: String): Int {

    var count = 0  // Initialize the count variable
    
    // Iterate over each character in the string
    for (i in 0 until string.length) {
        
        // Check if the current character is 'N'
        if (string[i] == 'N') {
            
            // Check if the remaining characters form 'None' starting from the current position
            if (string.substring(i, i + 4) == "None") {
                count++  // Increment the count variable
            }
        }
    }
    
    return count
}