Deformation of one fibonacci ..
[Cpp]
# Include <stdio. h>
# Include <string. h>
Int ans [55] [27];
Int main ()
{
Int n, I, j, t;
Char s1 [31], s2 [33];
Scanf ("% d", & t );
While (t --)
{
Scanf ("% s % d", s1, s2, & n );
Memset (ans, 0, sizeof (ans ));
For (I = 0; s1 [I]! = NULL; I ++)
Ans [0] [s1 [I]-'a'] ++;
For (I = 0; s2 [I]! = NULL; I ++)
Ans [1] [s2 [I]-'a'] ++;
For (I = 2; I <= n; I ++)
For (j = 0; j <26; j ++)
Ans [I] [j] = ans [I-1] [j] + ans [I-2] [j];
For (I = 0; I <26; I ++)
Printf ("% c: % d \ n", 'A' + I, ans [n] [I]);
Printf ("\ n ");
}
Return 0;
# Include <stdio. h>
# Include <string. h>
Int ans [55] [27];
Int main ()
{
Int n, I, j, t;
Char s1 [31], s2 [33];
Scanf ("% d", & t );
While (t --)
{
Scanf ("% s % d", s1, s2, & n );
Memset (ans, 0, sizeof (ans ));
For (I = 0; s1 [I]! = NULL; I ++)
Ans [0] [s1 [I]-'a'] ++;
For (I = 0; s2 [I]! = NULL; I ++)
Ans [1] [s2 [I]-'a'] ++;
For (I = 2; I <= n; I ++)
For (j = 0; j <26; j ++)
Ans [I] [j] = ans [I-1] [j] + ans [I-2] [j];
For (I = 0; I <26; I ++)
Printf ("% c: % d \ n", 'A' + I, ans [n] [I]);
Printf ("\ n ");
}
Return 0;