Created
September 11, 2014 12:33
-
-
Save maksadbek/613b47fd238b1802d046 to your computer and use it in GitHub Desktop.
118A - 13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class StringTask{ | |
static String splitter(String word, char[] exclude){ | |
word = word.toLowerCase(); | |
boolean contains; | |
StringBuilder consonants = new StringBuilder(); | |
for(int i=0; i < word.length(); i++){ | |
contains = false; | |
for(char ch: exclude){ | |
if(word.charAt(i) == ch){ | |
contains = true; | |
break; | |
} | |
} | |
if(!contains){ | |
consonants.append('.'); | |
consonants.append(word.charAt(i)); | |
} | |
} | |
return consonants.toString(); | |
} | |
public static void main(String[] args){ | |
char[] vowels = {'a', 'o', 'y', 'e', 'u', 'i'}; | |
Scanner input = new Scanner(System.in); | |
String inputs = input.nextLine(); | |
String output = splitter(inputs, vowels); | |
System.out.println(output); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment