Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • About Us
  • 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

April 23, 2017 – Make Selenium Easy Uncategorized
Compare Two Excel Workbooks Using Apache POI Uncategorized
selenium testng tutorials Uncategorized
How To Verify Functionality Of Back To Top Button In Selenium WebDriver Uncategorized
Untitled Diagram.jpg – Make Selenium Easy Uncategorized
oauth Uncategorized

Recent Posts

  • Implicit Wait vs Explicit Wait vs Fluent Wait in Selenium
  • Handling Text Fields, Text Areas, and Input Forms in Selenium
  • How to Handle Checkboxes and Radio Buttons in Selenium
  • Working with Dropdowns and Select Class in Selenium
  • How to Handle Dynamic Web Elements in Selenium

Recent Comments

No comments to show.

Archives

  • July 2026
  • June 2026
  • May 2026
  • 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
  • Locators and Elements
  • Uncategorized
  • Waits and Synchronization

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark