Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.gmail.sergiopartner;
- import java.util.Arrays;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Input text " + '"' + "Big boss love big beef hamburger" + '"');
- String a = sc.nextLine();
- char[] b = a.toCharArray();
- int n = 0;
- for (int i = 0; i < b.length; i += 1) {
- if (b[i] == 'b' || b[i] == 'B') {
- n += 1;
- }
- }
- System.out.println("This sentence has " + n + " letters " + '"' + "b" + '"');
- }
- }
Add Comment
Please, Sign In to add comment