问题描述:
Write a function to convert the given snake case string to camel case string by using regex.

测试用例:
["assert snake_to_camel('android_tv') == 'AndroidTv'", "assert snake_to_camel('google_pixel') == 'GooglePixel'", "assert snake_to_camel('apple_watch') == 'AppleWatch'"]

生成的代码:
import re

def snake_to_camel(snake_str):
    # Use regex to find underscores and capitalize the following letter
    camel_case = re.sub(r'_(.)', lambda x: x.group(1).upper(), snake_str)
    # Capitalize the first letter of the result
    return camel_case.capitalize()

# Test cases
assert snake_to_camel('android_tv') == 'AndroidTv'
assert snake_to_camel('google_pixel') == 'GooglePixel'
assert snake_to_camel('apple_watch') == 'AppleWatch'