fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. private static string[,] FB = new string[3,3]{
  7. {"FizzFizz", "Buzz", "Buzz"},
  8. {"Fizz", "FizzBuzz", "BuzzBuzz"},
  9. {"Fizz", "BuzzBuzz", "BuzzBuzz"}
  10. };
  11. private static string FizzBuzz(string str) {
  12. return FB[
  13. Math.Min(str.Count(c => c == 'a'), 2),
  14. Math.Min(str.Count(c => c == 'b'), 2)
  15. ];
  16. }
  17.  
  18. public static void Main() {
  19. string str;
  20. while ((str = Console.ReadLine()) != null) {
  21. Console.WriteLine("{0} ==> {1}",str, FizzBuzz(str));
  22. }
  23. }
  24.  
  25. }
Success #stdin #stdout 0.03s 33856KB
stdin
aabab
bbab
ccac
bccc
abcc
xxyz
stdout
aabab ==> BuzzBuzz
bbab ==> BuzzBuzz
ccac ==> Fizz
bccc ==> Buzz
abcc ==> FizzBuzz
xxyz ==> FizzFizz