013-004-004

Pattern Class: Digit Check

Easy

Problem Description

Pattern Class: Digit Check

Learning Objective: Check digits only with regex

Create program checking if input string consists only of digits. Check digit pattern [0-9]+ with Pattern.matches.

Input

Line 1: String to check (String)

Output

Input: [input string]
Numbers only: [true/false]
```java

## Examples

### Example 1: Digits only
Input:
```java
12345
```java
Output:
```java
Input: 12345
Numbers only: true
```java

### Example 2: Letters and numbers mixed
Input:
```java
abc123
```java
Output:
```java
Input: abc123
Numbers only: false
```java

### Example 3: Boundary (1 digit)
Input:
```java
0
```java
Output:
```java
Input: 0
Numbers only: true

Test Cases

※ Output examples follow programming industry standards

Input:
12345
Expected Output:
Input: 12345
Numbers only: true
Input:
abc123
Expected Output:
Input: abc123
Numbers only: false
Input:
0
Expected Output:
Input: 0
Numbers only: true
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here

sc.close();
}
}
0 B / 5 MB

You have 9 free executions remaining