There are many causes of premature grey hair.
Common cause is
vitamin B12 or other vitamin deficiency, bad diet habits, genetic.
Sometimes even if you are having good nutritious balanced diet, vitamins might not be absorbed into body due to drugs like ranitidine and other problems like pernicious Anemia.
Next Steps
consult me/ other dermatologist for proper prescription.
Health Tips
eat a healthy, balanced diet(which includes fruits, vegetables, milk, curd, meat).
avoid taking ranitidine, pantoprazole unless prescribed by a doctor.