stefans

kumanovski dijalekt

Feb 10th, 2016
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.HashMap;
  3.  
  4. public class KumanovskiDijalekt {
  5.  
  6. public static void main(String[] args) {
  7. Scanner std = new Scanner(System.in);
  8. int N = Integer.parseInt(std.nextLine());
  9. String[] s;
  10. HashMap<String, String> tabela = new HashMap<>();
  11. for (int i = 0; i < N; i++) {
  12. s = std.nextLine().split(" ");
  13. tabela.put(s[0], s[1]);
  14. }
  15. String[] text = std.nextLine().split(" ");
  16. String nov = "",temp="",bez="";
  17. Character znak;
  18. for (int i = 0; i < text.length; i++) {
  19. nov=Character.toLowerCase(text[i].charAt(0))+text[i].substring(1,text[i].length());
  20. bez=text[i].substring(0,text[i].length()-1);
  21. znak = text[i].charAt(text[i].length()-1);
  22. if (tabela.containsKey(text[i])) {
  23. System.out.print(tabela.get(text[i]) + " ");
  24. }
  25. else if(tabela.containsKey(nov)) {
  26. temp=Character.toUpperCase(tabela.get(nov).charAt(0)) + tabela.get(nov).substring(1,tabela.get(nov).length());
  27. System.out.print(temp + " ");
  28. }
  29. else if(tabela.containsKey(bez))
  30. {
  31. System.out.print(tabela.get(bez)+znak+" ");
  32. }
  33. else System.out.print(text[i] + " ");
  34. }
  35. }
  36. }
Add Comment
Please, Sign In to add comment