You are on page 1of 1

import java.io.

*;
import java.util.*;

/*
* To execute Java, please define "static void main" on a class
* named Solution.
* WAP to process the String input = "a2b3Zc4" and display the output as output =
"aabbbZcccc"
* WAP to extract text from the following string "H@ello Wsfgsdgs2elco2me T*o
Interview345__"
* If you need more classes, simply define them inline.
*/

class Solution {
public static void main(String[] args) {

String result = "";


String str = "H@ello &$ W2elco2me T*o Interview345__";
str = str.replaceAll("^[a-zA-Z]", "");

for(int i=0; i<str.length();i++){

if( Character.isAlphabetic(str.charAt(i)) || str.charAt(i) == " "){

result = result+str.charAt(i);

System.out.println(result);

}
}

You might also like