Skip to content

Instantly share code, notes, and snippets.

@kryvoboker
Created May 10, 2020 18:32
Show Gist options
  • Save kryvoboker/5bf9c9e3c7b00a8edf81b36cd479ef3a to your computer and use it in GitHub Desktop.
Save kryvoboker/5bf9c9e3c7b00a8edf81b36cd479ef3a to your computer and use it in GitHub Desktop.
HomeWork5
import java.util.Arrays;
import java.util.Scanner;
/**
*
* @author kamaz
*/
public class Main {
public static void main(String [] args) {
Scanner sc = new Scanner(System.in);
String a = sc.nextLine();
char [] letterArray = a.toCharArray();
int n = 0;
for (int i = 0; i < letterArray.length; i++) {
if (letterArray[i] == 'b') {
n += 1;
}
}
System.out.println(Arrays.toString(letterArray));
System.out.println(n);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment