标签:2015华为机试 java 算法 math hashmap
描述:5
代码如下:
public class dayin_Char
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
while (sc.hasNext())
{
String input=sc.nextLine();
if (input==null)
{
return;
}
int count=0;
Map<Integer,Character> hm=new HashMap<Integer, Character>();
for (int i = 0; i < input.length(); i++)
{
if (!hm.containsValue(input.charAt(i)))
{
count++;
hm.put(i, input.charAt(i));
}
}
System.out.println(count);
}
}
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:2015华为机试 java 算法 math hashmap
原文地址:http://blog.csdn.net/zzc8265020/article/details/46923917