write a java program to count of uppercase and count of lowercase & output will be in the form of (up-lc)


Program
import java.util.Scanner; public class ContNext { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Enter the string"); String str=sc.nextLine(); int uc=0,lc=0; if(str.matches("[A-Za-z ]+")&&str.length()<10) { for(int i=0;i<str.length();i++) if(Character.isUpperCase(str.charAt(i))) { uc++; } else if(Character.isLowerCase(str.charAt(i))){ lc++; } System.out.println(uc-lc); } } }
Input
Output