================================================================================
  Question 4: Menu-Driven String Manipulation System
================================================================================

FULL QUESTION:
Write a menu-driven program that performs the following operations on strings:
1. Check if the string is a substring of another string.
2. Count Occurrences of Character.
3. Replace a substring with another substring.
4. Convert to Capital Letters.

SHORT QUESTION:
Menu-driven program offering substring search, character occurrence counting, substring replacement, and capitalization.

================================================================================
README & SETUP INSTRUCTIONS:
================================================================================
# Question 4: Menu-Driven String Manipulation System

- Prerequisites: Python 3.x (Standard library only).
- Setup: None.
- How to Run: python question_04.py
- Expected Behavior: Provides an interactive command-line menu for string manipulation operations.

================================================================================
SOURCE CODE FILES:
================================================================================

1. question_04.py
--------------------------------------------------------------------------------
string = input("Enter the target string: ")

menu = "\n 1. Check Substring\n 2. Count Characters\n 3. Replace Substring\n 4. Convert to Capital\n 0. Exit"

print(menu)
choice = int(input("Enter your choice: "))

while choice != 0:
    if choice == 1:
        sub_str = input("Enter the substring to look for: ")
        if sub_str in string:
            print(f"Success: '{sub_str}' was found inside '{string}'")
        else:
            print(f"Failed: '{sub_str}' is NOT inside '{string}'")

    elif choice == 2:
        ch = input("Enter the character to count: ")
        print(f"No. of occurrences of '{ch}': {string.count(ch)}")

    elif choice == 3:
        old_sub = input("Enter the text to replace: ")
        new_sub = input("Enter the new replacement text: ")

        if old_sub in string:
            string = string.replace(old_sub, new_sub)
            print("Updated target string:", string)
        else:
            print(f"Error: '{old_sub}' is NOT inside '{string}'")

    elif choice == 4:
        print("Capitalized String:", string.upper())

    else:
        print("Invalid choice! Please choose a number from 0 to 4.")

    print(menu)
    choice = int(input("Enter your choice: "))

print("Exiting..")
--------------------------------------------------------------------------------
