Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Frequently Asked Java Program 20: Java Program to Find Missing Alphabets in Given String

Posted on 03/16/2025 By admin

This program was asked in Siemens.

Problem Statement:

You need to find missing alphabets from a given string. E.g.

User input: “Amod Mahajan”

Output: [B, C, D, E, F, G, H, I, J, K, L, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, b, c, e, f, g, i, k, l, p, q, r, s, t, u, v, w, x, y, z]

Solution:

Logic step by step:

Step 1: Remove all whitespaces from given string as we just need characters of given string. To do this, we can use replaceAll() method of String class. I will remove all white spaces into empty space. E.g. userInput.replaceAll(” “, “”)

Step 2: We need to extract each character from given string and store in an array. We can do this using split() method. E.g.

String [] inputStringArray = userInput.split(“”);

Step 3: Create an array of alphabets including upper and lower alphabets.

String alphabets[]= “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ”.split(“”);

Step 4: Now create a Set of above arrays. Set is useful to remove duplicate characters and find intersection of arrays.

Complete Java Program:

[java]
package StringPrograms;

import java.util.Arrays; import java.util.HashSet;

import java.util.Scanner;

Uncategorized

Post navigation

Previous Post: Frequently Asked Java Program 23: Java Program to Remove Extra WhiteSpace Between Words In Given String
Next Post: Ruto

Related Posts

Contact Uncategorized
ReScrollTo500 – Make Selenium Easy Uncategorized
Selenium interview expereince Uncategorized
TestNG Tutorials 68 : Rerun Failed Test Method Using IRetryAnalyzer Interface – Implement Using retryAnalyzer attribute in the @Test annotation Uncategorized
Postman Tutorial Part 54 – Chaining Requests or Data Sharing among requests in Postman Uncategorized
Part 2: Handling Single Select Drop-down Created Using SELECT Tag Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark