Skip to content

Latest commit

 

History

History
221 lines (135 loc) · 2.92 KB

File metadata and controls

221 lines (135 loc) · 2.92 KB

Welcome

String Methods

Automated grading of homework assignments and tests

  • fork this repository
  • solve the task
  • commit with proper message

Problems

String01

A str of several words is given. All letters are lowercase. Make sure that the first letter of each word is capitalized.

Example 1:

Input: a="google is a search engine"
Output: "Google Is A Search Engine"

Constraints:

  • 2 <= length(a) <= 10^5

String02

A str of several words is given. All letters are lowercase. Return all letters to uppercase.

Example 1:

Input: a="apple is a fruit"
Output: "APPLE IS A FRUIT"

Constraints:

  • 2 <= length(a) <= 10^5

String03

A str of several words is given. All letters are capitalized. Return all letters in lower case.

Example 1:

Input: a="IPHONE IS A MOBILE"
Output: "iphone is a mobile"

Constraints:

  • 2 <= length(a) <= 10^5

String04

A variable of type str is given. make sure all letters are lowercase.

Example 1:

Input: a="codeschool"
Output: True

Example 2:

Input: a="Mobile"
Output: False

Constraints:

  • 2 <= length(a) <= 10^5

String05

A str of several words is given. Return the variable capitalized.

Example 1:

Input: a="mobile development"
Output: "Mobile development"

Example 2:

Input: a="python programming"
Output: "Python programming"

Constraints:

  • 2 <= length(a) <= 10^5

String06

A variable of type str is given. Check that it consists only of numbers.

Example 1:

Input: a="12345"
Output: True

Example 2:

Input: a="2022ABC"
Output: False

Constraints:

  • 2 <= length(a) <= 10^5

String07

A variable of type str is given. Check that it consists of letters only.

Example 1:

Input: a="12345"
Output: False

Example 2:

Input: a="2022ABC"
Output: False

Constraints:

  • 2 <= length(a) <= 10^5

String08

A variable of type str is given. Make sure it only consists of uppercase letters.

Example 1:

Input: a="CODESCHOOL"
Output: True

Example 2:

Input: a="Mobile"
Output: False

Constraints:

  • 2 <= length(a) <= 10^5

String09

A str containing the letter "a" is given. Find the number of letters "a" in this variable.

Example 1:

Input: a="google is a search engine"
Output: 3

Example 2:

Input: a="Mobile development"
Output: 0

Constraints:

  • 2 <= length(a) <= 10^5

String10

A string containing the letter "x" is given. Find the index of the letter "x" in this variable.

Example 1:

Input: a="Mobile tpye xiomi"
Output: 12

Example 2:

Input: a="iphone x is a mobile"
Output: 7

Constraints:

  • 2 <= length(a) <= 10^5

Warning

  • don't copy other solutions or any solution
  • don't remove comments