package test.checktag; import java.util.Stack; public class CheckTag { public int getWrongTags(String tag) { //Write your code here return -1; } // You could use this sample code to test your functions // Following main fucntion contains 3 representative test cases public static void main(String args[]) { //Test case 1: try { CheckTag obj = new CheckTag(); String tag = "< Top < financial leaders, < faced with the biggest crisis to hit the global economy in at least a decade, are pledging to strengthen their regulation of banks and other financial institutions while anxiously hoping the slump in the United States will be a short one.> "; int noOfWrongTags = obj.getWrongTags(tag); System.out.println("TestCase 1"); if (noOfWrongTags > -1) { System.out.println("Total number of wrong tag = " + noOfWrongTags); } else System.out.println(noOfWrongTags); } catch (Exception e) { e.printStackTrace(); } //Test case 2: try { CheckTag obj = new CheckTag(); String tag = "< Top < financial leaders, < faced >>>with > << the biggest crisis to hit the global economy in at least a decade, are pledging to strengthen their regulation of banks in the United States will be a short one. "; int noOfWrongTags = obj.getWrongTags(tag); System.out.println("TestCase 2"); if (noOfWrongTags > -1) { System.out.println("Total number of wrong tag = " + noOfWrongTags); } else System.out.println(noOfWrongTags); } catch (Exception e) { e.printStackTrace(); } //Test case 3: try { CheckTag obj = new CheckTag(); String tag = null; int noOfWrongTags = obj.getWrongTags(tag); System.out.println("TestCase 3"); if (noOfWrongTags > -1) { System.out.println("Total number of wrong tag = " + noOfWrongTags); } else System.out.println(noOfWrongTags); } catch (Exception e) { e.printStackTrace(); } } }