We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package main.java.com.poogle.BOJ.Q1919; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList<Character> aList = new ArrayList<>(); ArrayList<Character> bList = new ArrayList<>(); String a = sc.nextLine(); String b = sc.nextLine(); for (int i = 0; i < a.length(); i++) { aList.add(a.charAt(i)); } for (int i = 0; i < b.length(); i++) { bList.add(b.charAt(i)); } Collections.sort(aList); Collections.sort(bList); for (int i = 0; i < aList.size(); i++) { for (int j = 0; j < bList.size(); j++) { if (aList.get(i) == bList.get(j)) { aList.remove(aList.get(i)); bList.remove(bList.get(j)); i--; break; } } } int cnt = aList.size() + bList.size(); System.out.println(cnt); sc.close(); } }
package main.java.com.poogle.BOJ.Q1919; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int count = 0; String word1 = scan.next(); String word2 = scan.next(); // 단어별로 알파벳 담을 배열 int[] arr1 = new int[26]; int[] arr2 = new int[26]; for (int i = 0; i < word1.length(); i++) arr1[word1.charAt(i) - 'a']++; for (int i = 0; i < word2.length(); i++) arr2[word2.charAt(i) - 'a']++; // 각 알파벳 별로 차이만큼(절댓값) 제거하기 for (int i = 0; i < 26; i++) if (arr1[i] != arr2[i]) count += Math.abs(arr1[i] - arr2[i]); System.out.println(count); scan.close(); } }
The text was updated successfully, but these errors were encountered:
c3fb124
suhyunsim
No branches or pull requests
문제
핵심 아이디어
어려운 점, 실수
풀이
The text was updated successfully, but these errors were encountered: