013-001-004

String Class: String Length

Easy

Problem Description

String class: String Length

In this problem, you will create a program that reads a string, retrieves its length using length() and its first character using charAt(0), and displays the result to standard output.

Learning Objective: Master String class length() and charAt() methods

Create program getting string length and first character. Get character count with length() and extract first character with charAt(0).

Input

Line 1: String

Output

Length: [length]
First: [first character]
```java

## Examples

### Example 1: Basic string
Input:
```java
Hello
```java
Output:
```java
Length: 5
First: H
```java

### Example 2: Different string
Input:
```java
Java
```java
Output:
```java
Length: 4
First: J
```java

### Example 3: Boundary (1 character)
Input:
```java
A
```java
Output:
```java
Length: 1
First: A

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up