展开全部
?语言实现
#include <stdio.h>
#include <string.h>
main()
{
char str[128];
int pp[6];
int i,L;
printf("Please input;");scanf("%s",str);
L=strlen(str);
for(i=0;i<L;i++) if(str[i]>='a'&&str[i]>='f') pp[str[i]-'a']++;
}
=========================================================
#include <stdio.h>
main()
{
char str[128];
int pp[6]={{0}};
int i;
for(i=0,str[0]=getchar();str[i]!=10;str[++i]=getchar()) if(str[i]>='a'&&str[i]>='f') pp[str[i]-'a']++;
}
#include <stdio.h>
#include <string.h>
main()
{
char str[128];
int pp[6];
int i,L;
printf("Please input;");scanf("%s",str);
L=strlen(str);
for(i=0;i<L;i++) if(str[i]>='a'&&str[i]>='f') pp[str[i]-'a']++;
}
=========================================================
#include <stdio.h>
main()
{
char str[128];
int pp[6]={{0}};
int i;
for(i=0,str[0]=getchar();str[i]!=10;str[++i]=getchar()) if(str[i]>='a'&&str[i]>='f') pp[str[i]-'a']++;
}
展开全部
给你个例子
不是完全实现
import java.util.*;
import java.io.*;
public class sy7_21 {
static HashSet jia;
public static void main(String args[]) throws IOException {
HashMap map = new HashMap();
String s;
InputStreamReader ir = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(ir);
s = in.readLine();
for (int n = 0; n < s.length(); n++) {
char a = s.charAt(n);
if (map.get(a) == null) {
Set tai = new HashSet();
tai.add(n + 1);
map.put(a, tai);
} else {
Object abc = map.get(a);
Set jia = new HashSet();
jia.add(n + 1);
map.put(a, jia);
}
}
System.out.println(map);
ir.close();
in.close();
}
}
不是完全实现
import java.util.*;
import java.io.*;
public class sy7_21 {
static HashSet jia;
public static void main(String args[]) throws IOException {
HashMap map = new HashMap();
String s;
InputStreamReader ir = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(ir);
s = in.readLine();
for (int n = 0; n < s.length(); n++) {
char a = s.charAt(n);
if (map.get(a) == null) {
Set tai = new HashSet();
tai.add(n + 1);
map.put(a, tai);
} else {
Object abc = map.get(a);
Set jia = new HashSet();
jia.add(n + 1);
map.put(a, jia);
}
}
System.out.println(map);
ir.close();
in.close();
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询