program to get a particular pattern