Skip to content

Instantly share code, notes, and snippets.

@youngvctr
Created July 27, 2023 15:12
Show Gist options
  • Save youngvctr/6ad74d9574d639579f0dcd164650cca9 to your computer and use it in GitHub Desktop.
Save youngvctr/6ad74d9574d639579f0dcd164650cca9 to your computer and use it in GitHub Desktop.
BOJ | Greedy[1105] > 팔
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] input = sc.nextLine().split(" ");
if(input[0].length() != input[1].length()) System.out.println(0);
else {
int cnt = 0;
for (int i = 0; i < input[0].length(); i++) {
char a = input[0].charAt(i);
char b = input[1].charAt(i);
if(a != b) break;
if(a == b && a == '8') cnt++;
}
System.out.println(cnt);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment