Atlassian Interview Question

Given a String and a character return the output array where the array will have each character's minimum distance from the given character. For example if "atlassian" and "a" are given, return [0,1,1,0,1,2,1,0,1]