I am trying to read a string from serial monitor and compare it with anothe

//I am getting an error while comparing strings and printing another string. Here's the program
#include <SoftwareSerial.h>

#include <VirtualWire.h>
char incomingByte = 0;
String a;
String spd="speedlimit50";
String spd1="speedlimit30";
void setup(){
// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
Serial.begin(9600);
}
void loop(){
while(Serial.available()){
a=Serial.readString();
Serial.println(a);
}
}
int b=50;
int ret=strcmp(a, b);
void send (char *spd){
if(ret==0){
vw_send((uint8_t *)spd, strlen(spd));
vw_wait_tx(); // Wait until the whole message is gone
}
}

If you use char arrays instead of Strings, you can use the built-in function strstr(). That's a good place to start from.

In the arduino IDE, if you look at the examples, the "08.Strings" example, there are examples of String comparison codes there.

strcmp compares strings (lower case s), not Strings (capital S) or integers.

Try to prevent the use of String (capital S) objects in microcontroller based systems. They usually work fine in simple codes but might result in undefined behaviour at run time when your code becomes more complex as it can leave holes in your memory.