package com.menzus.gcj._2012.qualification.c;

import com.menzus.gcj.common.InputBlockParser;
import com.menzus.gcj.common.OutputProducer;
import com.menzus.gcj.common.impl.AbstractProcessorFactory;

public class CProcessorFactory extends AbstractProcessorFactory<CInput, COutputEntry> {
    public CProcessorFactory(String inputFileName) {
	super(inputFileName);
    }

    @Override
    protected InputBlockParser<CInput> createInputBlockParser() {
	return new CInputBlockParser();
    }

    @Override
    protected OutputProducer<CInput, COutputEntry> createOutputProducer() {
	return new COutputProducer();
    }
}

package br.com.problema.c;

import java.util.HashSet;

public class Numero {

	int num;

	public Numero(int num) {
		this.num = num;
	}

	public HashSet<Integer> numRecycled(int B) {
		String s = num + "";
		HashSet<Integer> recycleds = new HashSet<Integer>();
		int numeroCasas = s.length();
		System.out.print(num + "(");
		for (int i = 1; i < numeroCasas; i++) {
			String novoNum = s.substring(s.length() - i, s.length()) + s.substring(0, s.length() - i);
			int aux = Integer.parseInt(novoNum);

			if (aux <= B && aux > num) {
				recycleds.add(aux);
				System.out.print(" " + aux);
			}
		}
		System.out.print(")\n");

		return recycleds;
	}

	public int quantNumRecycled(int B) {
		return numRecycled(B).size();
	}
}
