给定一个由小写字母组成的字符串 ,求有多少小写字母出现了至少 次。 ,
示例1
输入
"aaabcd",2
输出
1
说明
只有小写字母'a'出现了至少2次。
示例2
输入
"aacbcbdefghijklmnopqrstuvwxyz",1
输出
26
说明
每种小写字母都至少出现了1次。
加载中...
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ public int howMany (String S, int k) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ int howMany(string S, int k) { // write code here } };
#coding:utf-8 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param S string字符串 # @param k int整型 # @return int整型 # class Solution: def howMany(self , S , k ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ public int howMany (string S, int k) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ function howMany( S , k ) { // write code here } module.exports = { howMany : howMany };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param S string字符串 # @param k int整型 # @return int整型 # class Solution: def howMany(self , S: str, k: int) -> int: # write code here
package main //import "fmt" /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ func howMany( S string , k int ) int { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ int howMany(char* S, int k ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param S string字符串 # @param k int整型 # @return int整型 # class Solution def howMany(S, k) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ def howMany(S: String,k: Int): Int = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ fun howMany(S: String,k: Int): Int { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ public int howMany (String S, int k) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ export function howMany(S: string, k: number): number { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ func howMany ( _ S: String, _ k: Int) -> Int { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param S string字符串 * @param k int整型 * @return int整型 */ pub fn howMany(&self, S: String, k: i32) -> i32 { // write code here } }
"aaabcd",2
1
"aacbcbdefghijklmnopqrstuvwxyz",1
26