Skip to content

Instantly share code, notes, and snippets.

@maksadbek
Created September 11, 2014 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maksadbek/613b47fd238b1802d046 to your computer and use it in GitHub Desktop.
Save maksadbek/613b47fd238b1802d046 to your computer and use it in GitHub Desktop.
118A - 13
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