Advertisement
Paarzivall

Untitled

Mar 13th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1.  
  2. public class K1_A {
  3.  
  4.     public static void main(String[] args) {
  5.         String[] tab = {"Ala_1", "Ela_12", "Zenon_15", "Krystyna_6", "Lucjan_5"};
  6.        
  7.         for(int i = 0; i < tab.length; i++) {
  8.             String nowy = "";
  9.             for(int j = tab[i].lastIndexOf("_") - 1; j >= 0; j--) {
  10.                 nowy = nowy + tab[i].charAt(j);
  11.             }
  12.             nowy = nowy + "_";
  13.             for(int j = tab[i].lastIndexOf("_") + 1; j < tab[i].length(); j++) {
  14.                 nowy = nowy + tab[i].charAt(j);
  15.             }
  16.             tab[i] = nowy;
  17.             System.out.println(tab[i]);
  18.         }
  19.  
  20.     }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement