Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main
- {
- public static void main(String[] args) throws IOException {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- String input = br.readLine();
- int counter = 0;
- for (int i=0; i<input.length(); i++) {
- counter = 1;
- while (i + 1 < input.length() && input.charAt(i) == input.charAt(i + 1)) {
- i++;
- counter++;
- }
- System.out.println(input.charAt(i)+" "+counter);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement