LCM1602 IIC V1 Display is Inconsistant.

I have been running the exact same code for the past two hours some times it will function other times the display shows nothing or gets stuck. I've attempted debugging it a thousand times however to no avail and every time i end up at the same code which works half the time.

The sketch is suppose to get a string from the serial monitor and then print it to the lcd screen.

The code is below.

#include <Wire.h>  
#include <LiquidCrystal_I2C.h> // Using version 1.2.1
 
// The LCD constructor - address shown is 0x27 - may or may not be correct for yours
// Also based on YWRobot LCM1602 IIC V1
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  

String input;
bool flag= false;
//int pin = 11;

void setup()
{
  lcd.begin(16,2); // sixteen characters across - 2 lines
  lcd.backlight();
  Serial.begin(9600);
}
 
 
void loop()
{
  while(Serial.available()){
    input=Serial.readString();
    Serial.print("\nYou input:");
    Serial.println(input);
    flag=false;
    break;
    }
    
  
  if(flag==false){
    delay(1000);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print(input);
    flag=true;
  }

  if(input=="done")
  {
    lcd.clear();
    }
}

DON'T CROSS-POST!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
http://forum.arduino.cc/index.php?topic=464322
I was going to spend some time looking at your code and helping you out but since you're not going to show respect to the rules of this forum I'm not going to bother.
Reported.

There are MULTIPLE lcd libraries for LCD.

You would need to supply a link to the source of the library.

I can see at least 7 of them in CREATE and know for sure there are many more.

Also what board and which version IDE as IIRC there was an issue with a version of the IDE and LCD`s