Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
51 lines (37 loc) · 1.24 KB

File metadata and controls

51 lines (37 loc) · 1.24 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package org.codingTest;
import java.util.HashMap;
public class e2020_3 {
public static void main(String[] args) {
// 이메일 주소 만들기
String S = "John Don; Peter Benjia Parke; Peter Benjia Parke; Marry Jane Waston-Parkek; John hey Don";
String C = "Example";
StringBuilder answer = new StringBuilder();
String email = "@"+C.toLowerCase()+".com";
String[] names = S.split("; ");
HashMap<String, Integer> hm = new HashMap<>();
for(String name:names) {
int nameCount = 1;
String original = name;
name = name.toLowerCase();
String[] namePart = name.replace("-", "").split(" ");
String newName = namePart[namePart.length-1] + "_" + namePart[0];
if(hm.containsKey(newName)) {
nameCount = hm.get(newName)+1;
hm.replace(newName, nameCount);
}
else {
hm.put(newName, nameCount);
}
//System.out.println("original = "+name);
if(nameCount > 1)
newName += nameCount;
//System.out.println("new = "+newName);
if(answer.length() > 0)
answer.append("; ");
answer.append(original + " <"+newName+email+">");
//answer.append(name);
}
System.out.println(answer);
String emailStr = answer.toString();
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.