Skip to content

Practice Sum of Digits of String After Convert

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1945
LeetCode Problem

Sum of Digits of String After Convert

Problem Statement

Replace each lowercase letter of s with its one-based alphabet position, a = 1 through z = 26, and concatenate those decimal representations. Then replace the resulting number with the sum of its decimal digits, repeating this digit-sum operation exactly k times. Return the final integer.

Source: Sum of Digits of String After Convert on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "iiii", k = 1
Output
36

# Example 2

Input
s = "leetcode", k = 2
Output
6

# Example 3

Input
s = "zbax", k = 2
Output
8

Constraints

1 <= s.length <= 100
1 <= k <= 10
s consists of lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Sum of Digits of String After Convert.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.