import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class class1 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("请输入你要检测的短语并用空格隔开:");
String a = s.nextLine();
String[] b = a.split(" ");
Map<String, Integer> map = new HashMap<String,Integer>();
for(int c = 0;c<b.length;c++)
{
if(map.containsKey(b[c]))
{
int d = (Integer)map.get(b[c]);
map.put(b[c],d+1);
}
else
{
map.put(b[c],1);
}
}
for(Object obj : map.keySet())
{
System.out.println(obj.toString()+" 一共出现了"+map.get(obj)+"次");
}
}
}
import java.util.Scanner;
public class class1 {
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
System.out.println("请输入你要输入的短语并用空格隔开:");
String a = stdin.nextLine();
String[] b = a.split(" ");
StringBuffer c = new StringBuffer();
for(int d=b.length-1;d>=0;d--)
{
c.append(b[d]+" ");
}
System.out.println(c);
}
}