File tree 1 file changed +40
-0
lines changed
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ package STr ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class thir {
6
+
7
+ public static void main (String [] args ) {
8
+ //alphanumeric
9
+
10
+ Scanner sc = new Scanner (System .in );
11
+ //how*was23your&today
12
+ System .out .println ("Enter alphanumeric String : " );
13
+
14
+ String str = sc .nextLine ();
15
+
16
+ StringBuffer alpha = new StringBuffer (),
17
+ num = new StringBuffer (),
18
+ special = new StringBuffer ();
19
+
20
+ for (int i =0 ; i <str .length (); i ++)
21
+ {
22
+ if (Character .isDigit (str .charAt (i )))
23
+ {
24
+ num .append (str .charAt (i ));
25
+ }else if (Character .isAlphabetic (str .charAt (i )))
26
+ {
27
+ alpha .append (str .charAt (i ));
28
+ }else {
29
+ special .append (str .charAt (i ));
30
+ }
31
+ }
32
+
33
+ System .out .println (num );
34
+ System .out .println (alpha );
35
+ System .out .println (special );
36
+
37
+
38
+ }
39
+
40
+ }
You can’t perform that action at this time.
0 commit comments