-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplitStrings.java
More file actions
26 lines (25 loc) · 1 KB
/
SplitStrings.java
File metadata and controls
26 lines (25 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.* ;
import java.io.*;
public class Solution {
public static Boolean splitString(String str) {
// Write your code here..
int countleft=0;
int countright=0;
int index=0;
while(index<str.length()/2){
if(str.charAt(index)=='a'||str.charAt(index)=='e'||str.charAt(index)=='i'||str.charAt(index)=='o'||str.charAt(index)=='u'||
str.charAt(index)=='A'||str.charAt(index)=='E'||str.charAt(index)=='I'||str.charAt(index)=='O'||str.charAt(index)=='U'){
countleft++;
}
index++;
}
while(index<str.length()){
if(str.charAt(index)=='a'||str.charAt(index)=='e'||str.charAt(index)=='i'||str.charAt(index)=='o'||str.charAt(index)=='u'
||str.charAt(index)=='A'||str.charAt(index)=='E'||str.charAt(index)=='I'||str.charAt(index)=='O'||str.charAt(index)=='U'){
countright++;
}
index++;
}
return countleft==countright;
}
}