A: How long have you lived / have you been living in this town?
B: I've been living here for twenty six years.
A: Where did you live before?
B: I used to live in St.Petersburg.
We use Present Perfect or Present Perfect Continuos to reffer to the period of time which began in the past and is still going on in the present. The other question is connected with the period of time which ended once and don't continue now therefore we can use either Past Simple or "used to".
Is it correct?