/**
 * Given two strings, str1 and str2, the function checks if str2 is not present as a substring in str1.
 * If str2 is present, it removes the first occurrence of str2 from str1 using the subtraction assignment operator.
 *
 * @param str1 The main string where substring presence will be checked and removed.
 * @param str2 The substring to be checked and removed from str1.
 * @return The modified string after removing the first occurrence of str2 if it is present. If str2 is not present, it returns the original str1.
 *
 * Example:
 * checkNotInOperatorAndSubtractionAssignmentOperator("programming", "gram")
 * >> "proing"
 *
 * checkNotInOperatorAndSubtractionAssignmentOperator("hello world", "world")
 * >> "hello "
 *
 * checkNotInOperatorAndSubtractionAssignmentOperator("python is fun", "java")
 * >> "python is fun"
 */
fun checkNotInOperatorAndSubtractionAssignmentOperator(str1: String, str2: String): String {

    if (str2 !in str1) {  // Checking if str2 is not present as a substring in str1
        return str1
    }
    return str1.replaceFirst(str2, "")  // Removing the first occurrence of str2 from str1
}
/**
 * Given two strings, str1 and str2, the function checks if str2 is not present as a substring in str1.
 * If str2 is present, it removes the first occurrence of str2 from str1 using the subtraction assignment operator.
 *
 * @param str1 The main string where substring presence will be checked and removed.
 * @param str2 The substring to be checked and removed from str1.
 * @return The modified string after removing the first occurrence of str2 if it is present. If str2 is not present, it returns the original str1.
 *
 * Example:
 * checkNotInOperatorAndSubtractionAssignmentOperator("programming", "gram")
 * >> "proing"
 *
 * checkNotInOperatorAndSubtractionAssignmentOperator("hello world", "world")
 * >> "hello "
 *
 * checkNotInOperatorAndSubtractionAssignmentOperator("python is fun", "java")
 * >> "python is fun"
 */
fun checkNotInOperatorAndSubtractionAssignmentOperator(str1: String, str2: String): String {
/**
 * Given two strings, str1 and str2, the function checks if str2 is not present as a substring in str1.
 * If str2 is present, it removes the first occurrence of str2 from str1 using the subtraction assignment operator.
 *
 * @param str1 The main string where substring presence will be checked and removed.
 * @param str2 The substring to be checked and removed from str1.
 * @return The modified string after removing the first occurrence of str2 if it is present. If str2 is not present, it returns the original str1.
 *
 * Example:
 * checkNotInOperatorAndSubtractionAssignmentOperator("programming", "gram")
 * >> "proing"
 *
 * checkNotInOperatorAndSubtractionAssignmentOperator("hello world", "world")
 * >> "hello "
 *
 * checkNotInOperatorAndSubtractionAssignmentOperator("python is fun", "java")
 * >> "python is fun"
 */
fun checkNotInOperatorAndSubtractionAssignmentOperator(str1: String, str2: String): String {

    if (str2 !in str1) {  // Checking if str2 is not present as a substring in str1
        return str1
    }
    return str1.replaceFirst(str2, "")  // Removing the first occurrence of str2 from str1
}