# Help me in solving HISC05 problem

### My issue

import java.util.*;

class Codechef
{
public static void main(String args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(); // no of disks
char tower_1 = sc.next().charAt(0);
char tower_2 = sc.next().charAt(0);
char tower_3 = sc.next().charAt(0);
toh(n, tower_1, tower_2, tower_3);
}

``````public static void toh(int n, char t1, char t2, char t3)
{
if (n == 0) return;
toh(n - 1, t1, t3, t2);
System.out.println("Disk " + n + " moved from " + t1 + " to " + t2);
toh(n - 1, t3, t2, t1);
}
``````

}

### My code

``````import java.util.*;

class Codechef
{
public static void main(String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(); // no of disks
char tower_1 = sc.next().charAt(0);
char tower_2 = sc.next().charAt(0);
char tower_3 = sc.next().charAt(0);
toh(n, tower_1, tower_2, tower_3);
}

public static void toh(int n, char t1, char t2, char t3)
{
if (n == 0) return;
toh(n - 1, t1, t3, t2);
System.out.println("Disk " + n + " moved from " + t1 + " to " + t2);
toh(n - 1, t3, t2, t1);
}
}

``````

Problem Link: HISC05 Problem - CodeChef