import java.util.Random;
class Main {
public static int charAt(String text, char c, int n) {
int pos = -1;
char[] charArray = text.toCharArray();
int count = 0;
for (int i = 0; i < charArray.length; i++) {
if (charArray[i] == c) {
++count;
if (count == n) {
pos = i;
break;
}
}
}
return pos;
}
}