Failed to pass one test case

import java.util.*;
public class Main {
public static void main(String args[]) {
// Your Code Here
Scanner scn=new Scanner(System.in);
String s1=scn.next();
String s2=scn.next();
PRINTLCS(s1,s2);

}
public static void PRINTLCS(String s1, String s2) {
	int strg[][] = new int[s1.length() + 1][s2.length() + 1];
	for (int row = s1.length(); row >= 0; row--) {
		for (int col = s2.length(); col >= 0; col--) {
			if (row == s1.length()) {
				strg[row][col] = 0;
				continue;
			}
			if (col == s2.length()) {
				strg[row][col] = 0;
				continue;
			}
			if (s1.charAt(row) == s2.charAt(col)) {
				strg[row][col] = 1 + strg[row + 1][col + 1];
			} else {
				strg[row][col] = Math.max(strg[row + 1][col], strg[row][col + 1]);
			}
		}
	}
	String ans = "";
	int i = 0;
	int j = 0;
	while (i < s1.length() && j < s2.length()) {
		if (strg[i][j] == strg[i + 1][j] && strg[i][j] == strg[i][j + 1]) {
			j++;
		} else if (strg[i + 1][j] == strg[i][j + 1]) {

			ans += s1.charAt(i);
			i++;
			j++;
		} else if (strg[i + 1][j] != strg[i][j + 1]) {
			if (strg[i + 1][j] > strg[i][j + 1]) {
				i++;
			} else {
				j++;
			}
		}
	}
	System.out.println(ans);
}

}

@guptadev354,
https://ide.codingblocks.com/s/228716 there was an error in your insertion method into the string ans. Also, make a dp from 0 to s1.length() + 1 instead of the other way around.