I m passing a string to s1..so how it can be null? plz help me to correct

see you have to take an input number from the user…according to that you have to print the values…
the function which prints the value should be of void type…

also you are facing error because s1 and s2 intialized to null…their values are not changed(their value will only change when there are equal adjacent numbers in the input)…
please check you logic once again…approach this problem as a normal recursive problem comprising of 3 steps:
1)base case
2)recursive call
3)self work