강의

멘토링

커뮤니티

Inflearn Community Q&A

sssunggure1586's profile image
sssunggure1586

asked

Introduction to Java Algorithm Problem Solving: Coding Test Preparation

안녕하세요 선생님 1-1 부터 오답이 떠서 질문드립니다.

Written on

·

144

0

코드를 아래와 같이 구현하였는데, 응답은 제대로 나오는데 계속해서 채점 사이트에서는 오답이라고 출력이 되네요.
 public static void main(String[] args) throws IOException {
// BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Scanner br = new Scanner(System.in);
String line1 = br.nextLine();
String line2 = br.next();

System.out.print(findAlphabet(line1, line2));
}

public static int findAlphabet(String line1, String line2){
char[] chars = line1.toCharArray();
char specialChar = line2.charAt(0);
int count = 0;
for (char aChar : chars) {
if(Character.isUpperCase(aChar)){
aChar = Character.toLowerCase(aChar);
}

if(aChar == specialChar){
count++;
}
}

return count;
}
java코테 준비 같이 해요!

Answer 1

0

codingcamp님의 프로필 이미지
codingcamp
Instructor

안녕하세요^^

"오답입니다" 를 클릭하면 오답이 나오는 입력케이스를 볼 수 있습니다. 강의소개란에 자세히 설명해 놓았으니 참조하세요.

아래 입력이 답이 나오지 않습니다. 답은 7입니다.

tttccttccTT

T

sssunggure1586's profile image
sssunggure1586

asked

Ask a question