€mám niečo takéto 
public static void main(String[] args) {
    Scanner vstup = new Scanner(System.in);
    String cesta = vstup.next();
    
    while (cesta.indexOf("/") != -1) {
        System.out.println( cesta.substring(0,pozicia) );
        cesta.delete(0, pozicia+1);
    }
} 
 

