Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package SamoglaskiSoglaski;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class SamoglaskiSoglaski {
- public static void pecati(SLL<Character> lista)
- {
- SLLNode<Character> tmp = lista.getFirst();
- while(tmp!=null)
- {
- System.out.print(tmp.element + " ");
- tmp = tmp.succ;
- }
- }
- public static SLL<Character> samoglaski(SLL<Character> lista)
- {
- SLLNode<Character> tmp= lista.getFirst();
- SLL<Character> samog = new SLL<Character>();
- while(tmp!=null)
- {
- if(tmp.element == 'a' || tmp.element == 'o' || tmp.element == 'e' || tmp.element == 'i' ||tmp.element == 'u')
- {
- samog.insertLast(tmp.element);
- }
- tmp = tmp.succ;
- }
- return samog;
- }
- public static SLL<Character> soglaski(SLL<Character> lista)
- {
- SLLNode<Character> tmp= lista.getFirst();
- SLL<Character> sog = new SLL<Character>();
- while(tmp!=null)
- {
- if(tmp.element != 'a' && tmp.element != 'o' && tmp.element != 'e' && tmp.element != 'i' & tmp.element != 'u')
- {
- sog.insertLast(tmp.element);
- }
- tmp = tmp.succ;
- }
- return sog;
- }
- public static void main(String[] args) throws IOException {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- SLL<Character> lista = new SLL<Character>();
- String s = br.readLine();
- for(int i=0; i<s.length(); i++)
- {
- lista.insertLast(s.charAt(i));
- }
- SLL<Character> samog = samoglaski(lista);
- SLL<Character> sog = soglaski(lista);
- pecati(samog);
- System.out.println();
- pecati(sog);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement