/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	static int buscaChar(String text, char c, int n) {
		int count = 0;
		for (int i = 0; i < text.length() - 1; i++) {
			if (text.charAt(i) == c) {
				count = count + 1;
				if (count == n)
					return i;
			}
		}
		return -1;
	}
	
	public static void main (String[] args) throws java.lang.Exception
	{
		String textCopy = "A linguagem processing e a mais divertida.";

		int test = buscaChar(textCopy, 'a', 4);

		System.out.println(test);
	}
}