Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package kkdprojekt3;
- import java.io.BufferedReader;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.IOException;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- public class Main {
- public static void main(String[] args) {
- String path1 = "in.txt";
- try {
- BufferedReader in = new BufferedReader(new FileReader(path1));
- //BufferedWriter out = new BufferedWriter(new FileWriter(path2));
- String line = null;
- while (in.ready()) {
- try {
- line = in.readLine();
- } catch (IOException ex) {
- Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
- }
- char c = line.charAt(0);
- char d = 0;
- //int seria = 0;
- String s = "";
- s += c;
- for (int i = 1; i < line.length(); i++) {
- d = line.charAt(i);
- //System.out.print(c + "-" + d + " ");
- if (c == d) {
- s += c;
- if (s.length() > 3) {
- seria++;
- System.out.print(seria + ":" + d);
- }
- } else {
- System.out.print(s);
- s = null;
- c = d;
- //i -= 1;
- /*if (seria > 0) {
- }*/
- //seria = 0;
- }
- }
- }
- } catch (FileNotFoundException ex) {
- Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
- } catch (IOException ex) {
- Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
Add Comment
Please, Sign In to add comment