Problem 130290 · medium · Phase 01 Prerequisites & Setup

Snake to Camel

strings · split · capitalize · join · slicing

Convert a snake_case identifier to camelCase: keep the first word entirely lowercase and capitalise the first letter of every following word, removing the underscores. Input words may arrive in any case. Consecutive or leading/trailing underscores are treated as a single separator (empty pieces are skipped).

Examples

Input:  name = "user_first_name"
Output: "userFirstName"

Input:  name = "HTTP_response_CODE"
Output: "httpResponseCode"

Input:  name = "__init__"
Output: "init"

Constraints

  • 0 <= len(name) <= 200
  • name contains only letters, digits and underscores

Goals

  • Split an identifier on underscores
  • Treat the first piece differently from the rest
  • Reassemble with `join`
Starting Python…