ICSE Computer Science Java Programs | IT Developer
IT Developer

Java Programs - Solved 2025 ICSE Computer Science Paper



Share with a Friend

Solved 2025 ICSE Computer Science Paper

Class 10 - ICSE Computer Science Solved Papers

Super String Program - ICSE 2025 Computer Science

Question 5
Define a class to accept a String and print if it is a Super String or not. A String is Super if the number of uppercase letters are equal to the number of lowercase letters. [Use Character and String methods only]


Example: “COmmITmeNt”
Number of uppercase letters = 5
Number of lowercase letters = 5
String is a Super String

import java.util.Scanner; class SuperString{ public static void main(String[] args){ Scanner in = new Scanner(System.in); System.out.print("Enter the string: "); String s = in.nextLine(); int upper = 0; int lower = 0; for(int i = 0; i < s.length(); i++){ char ch = s.charAt(i); if(Character.isUpperCase(ch)) upper++; else if(Character.isLowerCase(ch)) lower++; } if(upper == lower) System.out.println("String is a Super String"); else System.out.println("String is not a Super String"); } }

Output

 
OUTPUT 1:
Enter the string: COmmITmeNt
String is a Super String

OUTPUT 2:
Enter the string: UltraINFO
String is not a Super String