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
95 lines (83 loc) · 2.39 KB

File metadata and controls

95 lines (83 loc) · 2.39 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
*
*/
/**
* @author DELL
* Project Name: Java_learn
* Class Name: MAIN
* date: 2019年9月29日
*/
//import java.io.BufferedReader;
//import java.io.InputStreamReader;
//import java.io.IOException;
//public class MAIN {
//
// /**
// * @param args
// */
// public static void main(String[] args) throws IOException {
// // TODO Auto-generated method stub
// BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
//
// }
//
//}
//import java.util.*;
//public class MAIN {
//
// static int i=0;
//
// public static void move(int n,String x,String y,String z){
// if(n==1){
// i++;
// }else{
// move(n-1, x, z, y);
// i++;
// move(n-1, y, x, z);
// }
// }
//
// public static void main(String[] args) {
// // TODO Auto-generated method stub
//
// Scanner s=new Scanner(System.in);
// String chaXun=s.next();
// int count=Integer.parseInt(chaXun);
// MAIN.move(count, "X", "Y", "Z");
// System.out.println(i);
//
// }
//}
import java.util.regex.*;
//import java.util.spi.LocaleNameProvider;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class MAIN {
public static void main(String[] args) throws IOException {
String regEx1 = "[\\u4e00-\\u9fa5]";
String regEx2 = "[a-z||A-Z]";
String regEx3 = "[0-9]";
BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
String str = br1.readLine().trim();
String s1 = matchResult(Pattern.compile(regEx1),str);
String s2 = matchResult(Pattern.compile(regEx2),str);
String s3 = matchResult(Pattern.compile(regEx3),str);
int l1 = s1.length();
int l2 = s2.length();
int l3 = s3.length();
int l4 = str.length() - l1 - l2 -l3;
System.out.print("汉字个数:"+l1+","+"字母个数:"+l2+","+"数字个数:"+l3+","+"其它字符个数:"+l4+","+"数据中纯文本为:"+s1);
}
public static String matchResult(Pattern p,String str)
{
StringBuilder sb = new StringBuilder();
Matcher m = p.matcher(str);
while (m.find())
for (int i = 0; i <= m.groupCount(); i++)
{
sb.append(m.group());
}
return sb.toString();
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.