import java.util.Scanner; public class Main { public static void main(String[] args) { int x,n; String s; char ch[]; Scanner sc=new Scanner(System.in); System.out.println("Enter String :"); s=sc.nextLine(); n=s.length(); ch = s.toCharArray(); for(x=0;x<n;x++) { if(!(Character.isSpaceChar(ch[x]) || Character.isDigit(ch[x]) || Character.isLetter(ch[x])) ) { continue; } System.out.print(ch[x]); } } }
Enter String : sateesh@!@#
sateesh