Q2

mail@pastecode.io avatar
unknown
java
a year ago
391 B
1
Indexable
Never
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter your string : ");
        String myWords = scanner.nextLine();
        System.out.print("Total number of characters in a string : ");
        System.out.println(myWords.replaceAll(" ", "").length());
    }
}