Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class test {
- public static void main(String[] args) {
- String str = "Какой-то текст для примера";
- int max = 0;
- int chetchik = 0;
- char sim = 'т';
- max = str.length();
- for (int i = 0; i < max; i++){
- if (str.charAt(i) == sim) chetchik = chetchik + 1;
- if (chetchik > 1) {
- System.out.print("Символ повторяется 2 раза");
- break;
- }
- }
- if (chetchik < 2) System.out.print("Символ не повторяется более 2 раз");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement