#include <stdio.h>
#include <string.h>

int main() {
    const char *string = "Hello, and welcome to CS 262";
    const char *substring = "CS";
    
    char *result = strstr(string, substring);
    
    if (result) {
        /*
            // this works because the pointer arithmetic is done in bytes. If the address for
            the string is 1000 and the address for the substring is 1005, the result will be 5.
        */
        printf("Substring found at position: %d\n", result - string); 
    } else {
        printf("Substring not found.\n");
    }
    
    return 0;
}
