#include <stdio.h>
#include <assert.h>
#include<iostream.h>
#define T 100
char ch[T+1];
char src[T];
char ans[T];
int N ;
int M;
void input()
{
scanf("%d%d" , &N , &M);
scanf("%s" , ch);
//printf("N=%d; M=%d; str=%s/n" , N , M , ch);
}
//从ch[bg] - ch[N-1] 中选 c 个字符
//前面 M-c 个字符已经填好,还剩 c 个字符要填(总共要 M 个字符)
//从ans[M-c]开始填
int solve(int bg , int c)
{
int i , j , k;
int tofill = M-c;//从ans[tofill]开始填
if(c == 1)//填最后一个字符,把所有剩余可以填的字符(ch[bg]-ch[N-1])都试一遍
{
for(i = bg; i < N; i++)//
{
ans[tofill] = ch[i];
printf("%s/n" , ans);
}
return N-bg;
}
if(c == N - bg)//要填C个字符,并且只有C个字符可以填(ch[bg]-ch[N-1])
{
for(i = bg; i < N; i++)
{
ans[tofill++] = ch[i];
}
printf("%s/n" , ans);
return 1;
}
//取ch[bg]
ans[tofill] = ch[bg];//那个数学方法
int rt1 = solve(bg+1 , c-1);
//不取ch[bg]
int rt2 = solve(bg+1 , c);
return rt1 + rt2;
}
int main()
{
input();
int total = solve(0 , M);
printf("total : %d/n" , total);
return 0;
}