Skip to content

Commit 82669c5

Browse files
Merge pull request #5 from algorithm-cote-study/seunggu/week3
Seunggu/week3
2 parents b4ecc57 + 16abe67 commit 82669c5

File tree

200 files changed

+4829
-131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+4829
-131
lines changed

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ build/
55
!**/src/test/**/build/
66

77
### IntelliJ IDEA ###
8-
.idea/modules.xml
9-
.idea/jarRepositories.xml
10-
.idea/compiler.xml
11-
.idea/libraries/
8+
.idea/*
129
*.iws
1310
*.iml
1411
*.ipr

.idea/gradle.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/sonarlint/issuestore/index.pb

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 175 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ dependencies {
1515
implementation 'org.junit.jupiter:junit-jupiter:5.8.1'
1616
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
1717
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
18+
19+
testCompileOnly 'org.projectlombok:lombok:1.18.12' // 테스트 의존성 추가
20+
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12' // 테스트 의존성 추가
21+
1822
}
1923

2024
test {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package sgyj.inflearn.seunggu;
2+
3+
import java.io.BufferedReader;
4+
import java.io.IOException;
5+
import java.io.InputStreamReader;
6+
7+
public class Main {
8+
/**
9+
* @title :
10+
* @description : 소문자로 된 한개의 문자열이 입력되면 중복된 문자를 제거하고 출력하는 프로그램을 작성하세요.
11+
* 중복이 제거된 문자열의 각 문자는 원래 문자열의 순서를 유지합니다.
12+
* @input : 첫 줄에 문자열이 입력됩니다. 문자열의 길이는 100을 넘지 않는다.
13+
* @output : 첫 줄에 중복문자가 제거된 문자열을 출력합니다.
14+
*/
15+
public static void main ( String[] args ) {
16+
try ( BufferedReader reader = new BufferedReader( new InputStreamReader( System.in ) ) ) {
17+
18+
} catch ( IOException e ) {
19+
e.printStackTrace();
20+
}
21+
}
22+
}

src/main/java/sgyj/inflearn/seunggu/week1/Solution1.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,21 @@ public class Solution1 {
1515
*/
1616
public static void main ( String[] args ) {
1717
try( BufferedReader reader = new BufferedReader( new InputStreamReader( System.in))) {
18-
String word = reader.readLine();
19-
String findChar = reader.readLine();
20-
String[] words = word.split( "" );
21-
int cnt = 0;
22-
for ( String s : words ) {
23-
if(s.equalsIgnoreCase( findChar )) cnt++;
24-
}
25-
System.out.println(cnt);
18+
System.out.println(solution( reader ));
2619
} catch ( IOException e ) {
2720
e.printStackTrace();
2821
}
2922
}
3023

24+
static int solution ( BufferedReader reader ) throws IOException {
25+
String word = reader.readLine();
26+
String findChar = reader.readLine();
27+
String[] words = word.split( "" );
28+
int cnt = 0;
29+
for ( String s : words ) {
30+
if(s.equalsIgnoreCase( findChar )) cnt++;
31+
}
32+
return cnt;
33+
}
34+
3135
}

0 commit comments

Comments
 (0)