Can’t change language (after disabling WPML translation plugin)

has anyone else ran into the issue of not being able to change the WordPress language after disabling a translation plug-in? I want to make the website language Dutch while it stays on English at the moment (which results in WooCommerce displaying in English).

WP-content writing permission is granted on the server, caching plug-in disabled, tried to change default language in the plug-in before disabling it.

i will translate english into any language, ultra high quality results for $10

i will translate english into any language, ultra high quality results

Tired of low quality translations?I am an expert, professional translator and writer, MD in Spanish Philology by University of Salamanca, Spain. I usually write for newspapers, magazines, business press releases… I offer my training and experience in Spanish language and my services as English to Spanish translator. Any job should take an amount of time to be properly done. I take my time with every order until I am totally sure it is PERFECT! No more doubts or worries about your translation, with me is professional and high quality, ready to show with no shame to your customers, boss, partners, students…I offer:- Very high quality translation, in a perfect, excellent Spanish. You will a get a clean and top level translation.


c – Hack machine language assembler as required for project 6 of Nand2Tetris

This is the implementation of the Assembler required to parse source code written in the Hack Machine Language and output it to a 16-bit binary file.

After writing one go in Swift, I decided I wanted to give it a go writing it in C as a challenge to myself to become more comfortable with the language as well as taking the opportunity to write my own hash table.

I’d love any feedback on any aspect of the code but I’m particularly looking for areas of improvement with regards to pointers and memory management. I don’t believe Valgrind is supported on M1 Mac machines, therefore the memory allocation and deallocation was written somewhat blind.

I’d also appreciate any pointers (no pun intended) on how I can improve adherence to C conventions.


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

#include "error/Error.h"
#include "components/Stripper.h"
#include "components/Parser.h"

#define MAX_ASSEMBLED_SIZE 1048576

static void assemble(const char *file, char *output_name);

// Entry point for program
int main(int argc, char** argv) {
    switch (argc) {
        case 2:
            // No file name specified - revert to "assembled.hack"
            assemble(argv(1), NULL);
        case 3:
            // Use client-specified file name
            assemble(argv(1), argv(2));
            // ❌
    return 0;


// Assembles a file into binary code
static void assemble(const char *file_name, char *output_name) {

    long size_in_bytes;
    char* file_to_assemble;
    printf("Starting assembly of file %sn", file_name);
    // Check if the file exists
    FILE *file = fopen(file_name, "r");
    if (file == NULL) {
    else {

        // Create a HashMap to store variables and label definitions
        HashMap* hash_map = hash_map_create();

        // Retrieve the size of the file (max 500k)
        fseek(file, 0, SEEK_END);
        size_in_bytes = ftell(file);

        if (size_in_bytes > MAX_ASSEMBLED_SIZE / 2) {
        fseek(file, 0, SEEK_SET); 
        file_to_assemble = malloc(size_in_bytes + 1);

        if (file_to_assemble) {
            // Read the contents of the file into the buffer
            fread(file_to_assemble, 1, size_in_bytes, file);
            char no_comments(size_in_bytes + 1);
            char no_spaces(size_in_bytes + 1);
            char no_labels(size_in_bytes + 1);
            char parsed(MAX_ASSEMBLED_SIZE + 1);
            // Remove comments and blank spaces. Save and remove labels, save variables
            strip_comments(no_comments, file_to_assemble);
            strip_spaces(no_spaces, no_comments);
            strip_labels(no_labels, no_spaces, hash_map);
            save_variables(no_labels, hash_map);

            // Translate the remaining assembly code to binary
            parse(parsed, no_labels, hash_map);

            char output_file_name(256);

            // If the client chose a custom output name
            if (output_name != NULL) {
                strcpy(output_file_name, output_name);
            else {
                strcpy(output_file_name, "assembled.hack");
            // Write the file
            FILE *output = fopen(output_file_name, "w");
            fwrite(parsed, 1, strlen(parsed), output);
            printf("Assembly complete");
        else {
            // Could not open file. Bail


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <ctype.h>
#include "HashMap.h"
#include "Parser.h"

#define SCREEN_ADDRESS 16384
#define KBD_ADDRESS 24576
#define SP_ADDRESS 0
#define LCL_ADDRESS 1
#define ARG_ADDRESS 2
#define THIS_ADDRESS 3
#define THAT_ADDRESS 4

// Removes extraneous white space and blank lines
void strip_spaces (char* dst, const char* src) {

    bool have_reached_printable_char = false;
    int count = 0;
    int length = strlen(src);

    while(*src != '') {
        if (count == length - 1 && *src == 'n')
        have_reached_printable_char = have_reached_printable_char ? true : isprint(*src);
        if(have_reached_printable_char && (*src == 'n' || !isspace(*src))) {
            *dst = *src; // then copy

    *dst = '';

// Remove comments (like this!) from file
void strip_comments(char* dst, const char* src) {

    bool copy = true;

    for (int i = 0; i < strlen(src); i++) {
        if (src(i) == 'n')
            copy = true;
        if (src(i) == "" && src(i+1) == "")
            copy = false;
        if (copy) {
            *dst = src(i);
    *dst = '';

// Map particular variables to corresponding address
static void map_reserved_variables(HashMap* hash_map) {
    hash_map_put(hash_map, "screen", SCREEN_ADDRESS);
    hash_map_put(hash_map, "kbd", KBD_ADDRESS);
    hash_map_put(hash_map, "sp", SP_ADDRESS);
    hash_map_put(hash_map, "lcl", LCL_ADDRESS);
    hash_map_put(hash_map, "arg", ARG_ADDRESS);
    hash_map_put(hash_map, "this", THIS_ADDRESS);
    hash_map_put(hash_map, "that", THAT_ADDRESS);

    for (int i = 0; i < 16; i++) {
        int length = i < 10 ? 2 : 3;
        char reg(length + 1);
        reg(0) = 'r';
        sprintf(reg + 1, "%d", i);
        hash_map_put(hash_map, reg, i);


// Remove label definitions and replace them with corresponding line number of
// logic following the definition
void strip_labels(char* dst, const char* src, HashMap* hash_map) {


    int current_command = 0;
    bool save_command = false;
    bool new_command = true;
    bool copy = true;
    char current_label(256);
    int current_label_index = 0;
    char last_copied;

    while(*src != '') {
        if (*src == 'n') {
            new_command = true;
            if (last_copied == 'n') {
            copy = true;

        if (*src == ')' && save_command) {  
            save_command = false;
            current_label(current_label_index) = '';
            // Move backwards to go back to the command we were dealing with
            for (int i = 0; i <= strlen(current_label); i++) {
                char lowered = tolower(current_label(i));
                current_label(i) = lowered;
            // Now move forward one line and save whatever command number that is
            hash_map_put(hash_map, current_label, current_command+1);
            current_label_index = 0;
        if (save_command) {
            current_label(current_label_index++) = *src;
        if (new_command && *src == '(') {
            save_command = true;
            copy = false;
        if (copy) {
            *dst = *src;
            last_copied = *src;
        *dst = '';

// Save any user declared variables
void save_variables(char* dst, HashMap* hash_map) {
    bool is_a_variable_declaration = false;
    char current_variable(256);
    int current_variable_index = 0;
    int current_variable_address = 16;

    while(*dst != '') {

        if (*dst == 'n') {
            if (is_a_variable_declaration) {
                is_a_variable_declaration = false;
                current_variable(current_variable_index) = '';
                current_variable_index = 0;

                if (!is_integral_string(current_variable)) {
                    if (hash_map_contains(hash_map, current_variable)) {
                        // It's a label declaration that we've already saved in the method above
                    else {
                        hash_map_put(hash_map, current_variable, current_variable_address++);
        if (is_a_variable_declaration) {
            current_variable(current_variable_index++) = tolower(*dst);
        if (*dst == '@') {
            char next = tolower(*(++dst));
            if (next != 'r' && next != '0') {
                is_a_variable_declaration = true;


#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "HashMap.h"
#include "Parser.h"
#include "../error/Error.h"

#define WORD_LENGTH 16

#define A_START 0

#define C_A_OR_M_START 3
#define C_A_OR_M_BIT_LENGTH 1


#define C_COMP_START 4

#define C_JUMP_START 13

#define C_DEST_START 10

// Declarations

static bool is_a_command(const char* str); 

static int jump_address(const char* str);
static int destination_address(const char* str);
static int get_computation_address(const char* cmd);
static int get_jump_address(const char* cmd, int jump_operation_position); 
static int get_destination_address(const char* cmd, int assignment_operation_position);

static void parse_c_command(char* dst, const char* cmd);
static void parse_command(char* dst, const char *cmd, HashMap* hash_map); 
static void parse_a_command(char* dst, const char* cmd, HashMap* hash_map); 
static void to_bin(char* cmd, int address, int number_of_places, int starting_position); 
static void get_positions(const char* cmd, int* assignment, int* computation, int *termination, int* jump); 

// *********** CONSTANTS ************** //

// Allowed destinations in C instruction
const char* valid_destinations(VALID_DESTINATION_COUNT) = { "M", "D", "MD", "A", "AM", "AD", "AMD" };
// Allowed computations in C instruction
const char* valid_computations(VALID_COMPUTATION_COUNT) = { "0", "1", "-1", "D", "A", "!D", "!A", "-D", 
                                                            "-A", "D+1", "A+1", "D-1", "A-1", "D+A", "D-A", 
                                                            "A-D", "D&A", "D|A", "M", "!M", "-M", "M+1", 
                                                            "M-1", "D+M", "D-M", "M-D", "D&M", "D|M" };
// Denary representation of a valid computation. 
// For example the instruction D|M (see above) corresponds to 21 -> (101001)
const int valid_computation_integers(VALID_COMPUTATION_COUNT) = { 42, 63, 58, 12, 48, 13, 49, 15, 
                                                                    51, 31, 55, 14, 50, 2, 19,
                                                                    7, 0, 21, 48, 49, 51, 
                                                                    55, 50, 2, 19, 7, 0, 21 }; 
// Allowed jump commands in C instruction
const char* valid_jumps(VALID_JUMP_COUNT) = { "JGT", "JEQ", "JGE", "JLT", "JNE", "JLE", "JMP" };

// *********** PARSING ************** //

// Parse a source asm file that has been stripped of whitespace and comments
void parse(char* dst, char* src, HashMap* hash_map) {

    char current_label(256);
    int current_label_position = 0;
    int dest_position = 0;

    for (int i = 0; i <= strlen(src); i++) {
        if (src(i) == 'n' || src(i) == '') {
            // We've either reached a line break or EOF
            current_label(current_label_position) = '';
            char parsed(WORD_LENGTH + 1);
            to_bin(parsed, 0, WORD_LENGTH, 0);
            parsed(WORD_LENGTH) = '';
            // Parse the current command
            parse_command(parsed, current_label, hash_map);
            for (int j = 0; j < strlen(parsed); j++) {
                // Add the newly parsed command to the output file
                dst(dest_position++) = parsed(j);   
            // Reset label posiion and add n or  to output
            current_label_position = 0;
            dst(dest_position++) = src(i);
        current_label(current_label_position++) = src(i);
    // Done, make sure to end with null terminator
    dst(dest_position) = '';

static void parse_command(char* dst, const char *cmd, HashMap* hash_map) {

    // Can either be A command ("@command") or C command ("D=D+1;JGE")
    if (is_a_command(cmd)) {
        parse_a_command(dst, cmd, hash_map);
    else {
        parse_c_command(dst, cmd);

static void parse_c_command(char* dst, const char* cmd) {

    int assignment_operation_position = 0;
    int computation_operation_position = 0;
    int jump_operation_position = 0;
    int computation_termination_position = 0;

    // Fill in parts of parsed command that are common to all C instructions
    get_positions(cmd, &assignment_operation_position, &computation_operation_position, &computation_termination_position, &jump_operation_position);

    // Split the command into destination (if applicable), computation and jump (if applicable)

    if (assignment_operation_position != 0) {
        int address = get_destination_address(cmd, assignment_operation_position);
        if (address == -1) {
        else { 
            to_bin(dst, address, C_DEST_BIT_LENGTH, C_DEST_START);

    int computation_string_length = computation_termination_position - computation_operation_position;
    char computation_string(computation_string_length + 1);
    strncpy(computation_string, cmd+computation_operation_position, computation_string_length);
    computation_string(computation_string_length) = '';
    int computation_address = get_computation_address(computation_string);

    if (computation_address == -1) {
    else {
        to_bin(dst, computation_address, C_COMP_BIT_LENGTH, C_COMP_START);
        for (int i = computation_operation_position; i < computation_termination_position; i++) {
            if (tolower(cmd(i)) == 'm') {
                to_bin(dst, 1, C_A_OR_M_BIT_LENGTH, C_A_OR_M_START);
    if (jump_operation_position != 0) {
        int address = get_jump_address(cmd, jump_operation_position);
        if (address == -1) {
        else {
            to_bin(dst, address, C_JUMP_BIT_LENGTH, C_JUMP_START);

static void parse_a_command(char* dst, const char* cmd, HashMap* hash_map) {

    size_t cmd_length = strlen(cmd);
    char lowered(cmd_length);
    int index = 0;

    // Disregard '@' by starting at index 1
    for (size_t i = 1; i <= cmd_length; i++) {
        lowered(index++) = tolower(cmd(i));
    if (!is_integral_string(lowered)) {
        // It's a user-declared variable
        int value = hash_map_get(hash_map, lowered);
        to_bin(dst, value, WORD_LENGTH, A_START);
    else {
        // It's a direct address (eg '@42')
        char address_string(cmd_length);
        strncpy(address_string, lowered, cmd_length);
        int address = atoi(address_string);
        to_bin(dst, address, WORD_LENGTH, A_START);

// *********** ADDRESSES ************** //

// Retreive generic address from array
static int get_address(const char* str, const char** argv, unsigned int count) {

    for (int i = 0; i < count; i++) {
        if (strcmp(str, argv(i)) == 0) {
            return i + 1;
    return -1;

// Retrieve destination address from C instruction
static int get_destination_address(const char* cmd, int assignment_operation_position) {

    char destination(assignment_operation_position + 1);
    strncpy(destination, cmd, assignment_operation_position);
    destination(assignment_operation_position) = '';
    return destination_address(destination);

static int destination_address(const char* str) {
    return get_address(str, valid_destinations, VALID_DESTINATION_COUNT);

// Retrieve computation address from C instruction
static int get_computation_address(const char* cmd) {

    for (int i = 0; i < VALID_COMPUTATION_COUNT; i++) {
        if (strcmp(valid_computations(i), cmd) == 0) {
            return valid_computation_integers(i);
    return -1;

// Retrieve jump address from C instruction
static int get_jump_address(const char* cmd, int jump_operation_position) {

    int jump_operation_length = strlen(cmd) - jump_operation_position;
    char jump_operation(jump_operation_length + 1);
    strncpy(jump_operation, cmd+jump_operation_position, jump_operation_length);
    jump_operation(jump_operation_length) = '';
    return jump_address(jump_operation);


static int jump_address(const char* str) {
   return get_address(str, valid_jumps, VALID_JUMP_COUNT);

// *********** HELPER ************** //

static bool is_a_command(const char* str) {
    return str(0) == '@' && strlen(str) > 1;

// Is the command pure integers?
bool is_integral_string(char *str) {

    size_t length = strlen(str);
    for (int i = 0; i < length; i++) {
        if (!isdigit(str(i))) {
            return false;
    return true;

// Retrieve positions of assignment, computation, 
// and jump instructions as well as the point of termination of a computation
static void get_positions(const char* cmd, int* assignment, int* computation, int *termination, int* jump) {

    size_t length = strlen(cmd);
    for (int i = 0; i < length; i++) {
        if (cmd(i) == '=') {
            *assignment = i;
            *computation = i+1;
        if (cmd(i) == ';') {
            *jump = i+1;
            *termination = i;
    if (*termination == 0) {
        *termination = length;

// Convert an address to binary padding with number of places, 
// starting (0 being the 'end' of the string) at starting_position
static void to_bin(char* cmd, int address, int number_of_places, int starting_position) {

    int quo = address;
    int index = number_of_places + starting_position - 1;

    int rem;
    for (int i = 0; i < number_of_places; i++) {
        rem = quo % 2;
        cmd(index--) = rem == 1 ? '1' : '0';
        quo = quo / 2;


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "HashMap.h"

// Hashing function, courtesy of
static int hashed(char* arg) {

    unsigned long hash = 5381;
    int c;
    while ((c = *arg++))
        hash = ((hash << 5) + hash) + c; 
    return hash % NUM_BUCKETS;

// Create a HashMap (caller to free) 
HashMap* hash_map_create() {
    HashMap *hash_map = malloc(sizeof(HashMap));
    for (int i = 0; i < NUM_BUCKETS; i++)
        hash_map->buckets(i) = NULL;
    return hash_map;

// Insert into HashMap (assumes non-negative value)
void hash_map_put(HashMap* hash_map, char* key, int value) {

    int hashed_key = hashed(key);
    int result = hash_map_get(hash_map, key);

    if (result != -1) {
        // Overwrite old value
        Node *current = hash_map->buckets(hashed_key);
        while (current->key != key) {
            current = current->next;
        current->value = value;
    else {
        if (hash_map->buckets(hashed_key) == NULL) {
            // Insert at first node in bucket
            hash_map->buckets(hashed_key) = malloc(sizeof(Node));
            hash_map->buckets(hashed_key)->key =  malloc(sizeof(char) * (strlen(key) + 1));
            strcpy(hash_map->buckets(hashed_key)->key, key);
            hash_map->buckets(hashed_key)->value = value;
            hash_map->buckets(hashed_key)->next = NULL;
        else {
            // Collision, traverse to end of linked list
            Node *current = hash_map->buckets(hashed_key);
            Node *new = malloc(sizeof(Node));
            new->key = malloc(sizeof(char) * (strlen(key) + 1));
            strcpy(new->key, key);
            new->value = value;
            new->next = NULL;
            while (current->next != NULL) {
                current = current->next;
            current->next = new;

bool hash_map_contains(HashMap* hash_map, char* key) {
    return hash_map_get(hash_map, key) != -1;

// Retrieve value for key from HashMap
int hash_map_get(HashMap* hash_map, char* key) {

    int hashed_key = hashed(key);
    Node *current = hash_map->buckets(hashed_key);
    int returned = -1;

    while (current != NULL) {
        if (strcmp(current->key, key) == 0) {
            returned = current->value;
        current = current->next;
    return returned;

// Remove value for key in HashMap
void hash_map_remove(HashMap* hash_map, char* key) {

    int hashed_key = hashed(key);
    if (hash_map_get(hash_map, key) != -1) {
        Node *current = hash_map->buckets(hashed_key);
        if (current->key == key) {
            // Remove from head node
            Node *new_current = current->next;
            current = NULL;
            hash_map->buckets(hashed_key) = new_current;
        else {
            // Traverse and remove when found
            while (current->next->key != key) {
                current = current->next;
            Node *old_next = current->next;
            Node *new_next = current->next->next;
            current->next = new_next;
            old_next = NULL;

// Free HashMap
void hash_map_free(HashMap* hash_map) {


#include <stdio.h>
#include <stdlib.h>
#include "Error.h"

void error_string_for_code(int code, char **star);

void exit_with_error(int code) {
    char *str = "";
    error_string_for_code(code, &str);
    printf("Exiting with error: '%s'n", str);

void error_string_for_code(int code, char **str) {
    switch (code) {
            *str = "Incorrect argument count";
        case FILE_NOT_FOUND:
            *str = "The file doesn't exist";
        case FILE_READ_ERROR:
            *str = "Could not read file";
        case NULL_POINTER:
            *str = "Null pointer found";
        case UNKNOWN_COMMAND:
            *str = "Unrecognized command";
            *str = "Invalid destination received";
            *str = "Received a missing computation";
        case MALFORMED_JUMP:
            *str = "Invalid jump received";
        case FILE_TOO_LARGE:
            *str = "File too large, please ensure it is less than 500kb";
            *str = "Unknown error.";

turing machines – How to prove that the problem $text{“If $L$ is a context-free language, then, is $overline{L}$ also context-free?”}$ is undecidable?

Lately I came across a problem:

$text{“If $L$ is a context-free language, then, is $overline{L}$ also context-free?”}$

And I need to comment on its decidability. Now I know that context free language is not closed under complementation. Had it been so, then this decision problem would have been trivially decidable. (In the sense that we could design a Turing Machine for this problem and allow it to always answer “YES”.)

Few of peers make a wrong logic behind the problem as follows. They say that the problem below is undecidable since CFLs are not closed under complementation. This logic/reasoning seems utter non-sense to me.

Yet few other peers try commenting about the decidability of the problem using Rice Theorem. They argue as follows:

Let $L$ be set of all CFLs. For this language whether any member’s complement is CFL or not is non trivial property. As CFL are not closed under complement. So According to Rice theorem it is undecidable.

But this above argument also does not convince me. I mean is it correct in the first place? I know the Rice Theorem and it states that :

Any non trivial property of Recursively Enumerable Languages is undecidable.

And my peer probably justifies this argument about Rice Theorem saying that all CFLs are also RE languages. But as far as I know, the “property” talked about in Rice Theorem is a predicate where the universe of discourse is the set of RE languages. Now if I reduce/chop this universe of discourse to contain only CFLs, then would things remain the same? I do not think so, (I might be wrong however.) in the sense that now we are dealing with just a smaller fraction of the entire set. (Like, for instance, the set $mathbb{N}$ is closed under addition, but the set ${1,2,..,10}$ is not.)

To apply Rice Theorem, I would defined the language of the property as:

$$L_p={langle M rangle | text{ L(M) is a context free language and $ overline{L(M)}$ is context free}}$$

Here the language $L_p$ is undecidable, because the property that “a RE language is context free and its complement is context free”, is non-trivial. But this non triviality arises primarily due to the check of RE language being context free. Is the actual decision problem correctly addressed by the $L_p$ above?

Moreover for decidability question I usually try to design a TM machine, but in this decision problem I am having no clue as to how to proceed? If I am given a CFL (using a finite description of course), then how do I design the TM to find the complement of this finite description? Once this complementation is done, we can check whether the language produced is a CFL. (But how?) This is a thought process which I have in my mind, but I cannot proceed.

Or is this decision problem problem much more notorious than it seems to be and do we next level thinking beyond the possible approaches which came to my mind? Please help.

PS: In the beautiful answer to a similar question, I have got the idea of how to answer the decidability question, but what still remains mysterious to me is the approach which my peers were following using Rice-Theorem, (is it at all correct?), and what could have been a possible raw TM machine approach? I guess this is how my question (probably) slightly differs from this…

complexity theory – Simplifying the Language of this DFA


Above’s the DFA in question (Sipser, Page 36). I have obtained the language of this DFA to be 0*1(1+00+01)*. But Sipser’s textbook goes on to explain that the language of this DFA is (0+1)*1(00)*. But I just cannot derive Sipser’s language from what I have obtained. Any help at all would be appreciated.

Why does he Go programming language return the same number each time with the rand.Intn() function ? Is it common in other languages?

Coming from Python, Ruby, and Java this different and surprising behavior. It seems like the typical way to actually get a different number each time it is run is to use a seed set to the unix time. I’m assuming there is a good reason for this choice and possibly some other languages have similar functionality.

Most spoken language in the world…?

Hello Everyone,

Please tell me, what is the most spoken language in the world…?

automata – Regular language closed under homomorphism

I am trying to solve problems from the textbook ‘Introduction to the Theory of Computation’ by Micheal Sisper, 3rd edition.

I am attempting to show various properties of regular languages and their closures under union, intersection, complementation, etc. An interesting one that I came across in the form of question 1.66 of the textbook is homomorphism. I’ll reproduce the question below.

A homomorphism is a function $f: Sigma longrightarrow Gamma^{*}$ from one alphabet to strings over another alphabet. We can extend $f$ to operate on strings by defining $f(w)=$ $fleft(w_{1}right) fleft(w_{2}right) cdots fleft(w_{n}right)$, where $w=w_{1} w_{2} cdots w_{n}$ and each $w_{i} in Sigma .$ We further
extend $f$ to operate on languages by defining $f(A)={f(w) mid w in A}$, for any language $A$.

a. Show, by giving a formal construction, that the class of regular languages is closed under homomorphism. In other words, given a DFA $M$ that recognizes $B$ and a homomorphism $f$, construct a finite automaton $M^{prime}$ that recognizes $f(B)$. Consider the machine $M^{prime}$ that you constructed. Is it a DFA in every case?

b. Show, by giving an example, that the class of non-regular languages is not closed under homomorphism.

The proof is intuitively clear to me as we can replace the label of each transition $w$ by its homomorphic function $h(w)$ and further split it into multiple transitions and states if the length of $h(w)$ is greater than one. I am unable to formalize it using the general five-tuple notation used to represent the DFA $M’$ that recognizes $f(B)$ given the string $B$.

Any help would be much appreciated, thanks in advance.

algorithms – Need help with a Minimum Window problem using the python language. Only the min_window function needs fixing

The “contains”function is used to determine if a string contains all of the letters a, b, and c. This function works fine.

def contains(string):
  sub = ("abc")
  result = ()
  var = "F"
  for i in range(len(sub)):
    if sub(i) not in string:
  if var not in result:
    return True
    return False

def min_window(arr):
  start = 0 
  curr_size = 0
  min_size = 1000
  final = ""

  for end in range(len(arr)):
    curr_string = arr(start:end)

    while contains(curr_string):
      curr_size = end - start + 1
      if curr_size < min_size:
        min_size = min(curr_size, min_size)
        final = curr_string
      start += 1
      curr_string = arr(start:end)


arr = ("adobecodebanc")

#the min_window function is used to find the smallest substring within a string that contains the three letters provided. This function seems to have some logical issue.

programming language does PHP resemble ?

Hypertext Preprocessor (PHP) is an independent programming language, which is used to designed web pages, php offently used to connect a website to the database to turn a simple website into a responsive website.