Generate a Number with B Repeated Digits A
Given two integesr A and B, where 1 ≤ A ≤ 9 and 1 ≤ B ≤ 10, construct a number consisting of the digit A repeated exactly B times.
Input format: Two integers A and B, separated by a comma (possibly with whitespace).
Output format: A single integer formed by repeating A, B times.
Example Input:
1, 5
Example Output:
11111
Example Input:
3 ,4
Example Output:
3333
line = input().strip()
a, b = line.split(',')
digit = a.strip()
count = int(b.strip())
result = digit * count
print(result)
Convert a Number from Any Base to Decimal
Given a number represented as a string and its base, convert it to its decimal (base-10) equivalent.
Input format: A string representing the number and its base, separated by a comma.
Output format: The decimal value of the input number.
Example Input:
45,8
Example Output:
37
input_line = input().strip()
num_str, base_str = input_line.split(',')
base = int(base_str)
decimal_value = int(num_str, base)
print(decimal_value)
Count Digits and Lowercase Letters in a String
Given a string, count how many characters are digits (0–9) and how many are lowercase letters (a–z).
Input format: One line of text.
Output format: 共有X个数字,Y个小写字符, where X and Y are the respective counts.
Example Input:
helo134ss12
Example Output:
共有5个数字,6个小写字符
text = input()
digit_count = 0
lowercase_count = 0
for char in text:
if '0' <= char <= '9':
digit_count += 1
elif 'a' <= char <= 'z':
lowercase_count += 1
print(f'共有{digit_count}个数字,{lowercase_count}个小写字符')