File tree Expand file tree Collapse file tree 3 files changed +97
-0
lines changed Expand file tree Collapse file tree 3 files changed +97
-0
lines changed Original file line number Diff line number Diff line change
1
+ import java .util .Scanner ;
2
+
3
+ public class CountChar {
4
+ public static void main (String ... arg ){
5
+ Scanner sc = new Scanner (System .in );
6
+ System .out .println ("Enter the String: " );
7
+ String s =sc .nextLine ();
8
+ sc .close ();
9
+ int count =0 ;
10
+ char res =' ' ;
11
+ String x ="" ;
12
+ char [] c =s .toCharArray ();
13
+ for (int j =0 ;j <s .length ();j ++){
14
+ for (int i =0 ;i <c .length ;i ++){
15
+ res =s .charAt (j );
16
+ if (c [i ]!='0' && c [i ]==res ){
17
+ count ++;
18
+ c [i ]='0' ;
19
+ }
20
+ }
21
+ if (count !=0 ){
22
+ System .out .println (res +" - " +count );
23
+ count =0 ;
24
+ }
25
+ else
26
+ count =0 ;
27
+ }
28
+ }
29
+ }
30
+
Original file line number Diff line number Diff line change
1
+ import java .util .Scanner ;
2
+
3
+ public class CountVowel {
4
+ public static String [] split (String s ){
5
+ int c = 0 ;
6
+ for (int i =0 ;i <s .length ();i ++){
7
+ if (s .charAt (i )==' ' ){
8
+ c +=1 ;
9
+ }
10
+ }
11
+ String [] st =new String [c +1 ];
12
+ String t ="" ;
13
+ int j =0 ;
14
+ for (int i =0 ;i <s .length ();i ++){
15
+ if (s .charAt (i )!=' ' ){
16
+ t += s .charAt (i );
17
+ }else {
18
+ st [j ++] = t ;
19
+ t = "" ;
20
+ }
21
+ }
22
+ st [j ]=t ;
23
+ return st ;
24
+ }
25
+ public static void main (String [] arg ){
26
+ Scanner sc = new Scanner (System .in );
27
+ System .out .println ("Enter the String: " );
28
+ String s = sc .nextLine ();
29
+ String vow ="aeiou" ;
30
+ String [] words =split (s );
31
+ String t ="" ;
32
+ int c =0 ;
33
+ for (int i =0 ;i <words .length ;i ++){
34
+ t +=words [i ];
35
+ for (int k =0 ;k <t .length ();k ++){
36
+ for (int j =0 ;j <vow .length ();j ++){
37
+ if (t .charAt (k )==vow .charAt (j )){
38
+ c ++;
39
+ }
40
+ }
41
+ }
42
+ System .out .println (t +"=" +c );
43
+ t ="" ; c =0 ;
44
+ }
45
+ }
46
+ }
47
+
48
+
Original file line number Diff line number Diff line change
1
+ import java .util .Scanner ;
2
+
3
+ public class SubString {
4
+ public static void main (String ... arg ){
5
+
6
+ Scanner sc = new Scanner (System .in );
7
+ System .out .println ("Enter the String: " );
8
+ String s =sc .nextLine ();
9
+ sc .close ();
10
+ for (int k =0 ;k <s .length ();k ++){
11
+ for (int i =k ;i <s .length ();i ++){
12
+ for (int j =k ; j <=i ;j ++){
13
+ System .out .print (s .charAt (j ));
14
+ }
15
+ System .out .println ();
16
+ }
17
+ }
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments