Untitled
unknown
plain_text
2 years ago
552 B
1
Indexable
Never
import java.util.Scanner; public class Act { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter Paragraph : "); String string = input.nextLine(); System.out.println( "Number of letters: " + countLetters(string)); } public static int countLetters(String s) { int numberOfLetters = 0; for (int i = 0; i < s.length(); i++) { if (Character.isLetter(s.charAt(i))) numberOfLetters++; } return numberOfLetters; } }