https://leetcode.com/problems/sum-of-digits-of-string-after-convert/



Runtime: 83 ms, faster than 57.14% of TypeScript online submissions for Sum of Digits of String After Convert.

Memory Usage: 46 MB, less than 7.14% of TypeScript online submissions for Sum of Digits of String After Convert.



```typescript
function the_transform(s: string): string {
    const nums = s.split('').map((value:string)=>Number(value))
    let sum = 0
    for (const num of nums) {
        sum += num
    }
    return String(sum)
}

function alphabet_to_index(s: string): string {
    let alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] 
    let chars = s.split("")
    return chars.map((char:string) => {
        return alphabets.indexOf(char) + 1
    }).join('')
}

function getLucky(s: string, k: number): number {
    //8:00
    let tempString = alphabet_to_index(s)
    for (let i = 0; i < k; i++) {
        tempString = the_transform(tempString)
    }
    return Number(tempString)
    //8:07
};
```
