fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. private static string s(int i)
  7. {
  8. return new string('+', i);
  9. }
  10. private static string GetBrainFuck(string t)
  11. {
  12. return string.Join("", t.Select(x => {
  13. int a = (int)Math.Sqrt(x);
  14. return string.Format("{0}[>{1}<-]>{2}.>",s(a) , s(x/a), s(x-a*(x/a)));
  15. }));
  16. }
  17.  
  18. public static void Main()
  19. {
  20. Console.WriteLine(GetBrainFuck("Hello world"));
  21. Console.WriteLine();
  22. Console.WriteLine(GetBrainFuck("Goodbye Brainfuck"));
  23. }
  24. }
Success #stdin #stdout 0.03s 15444KB
stdin
Standard input is empty
stdout
++++++++[>+++++++++<-]>.>++++++++++[>++++++++++<-]>+.>++++++++++[>++++++++++<-]>++++++++.>++++++++++[>++++++++++<-]>++++++++.>++++++++++[>+++++++++++<-]>+.>+++++[>++++++<-]>++.>++++++++++[>+++++++++++<-]>+++++++++.>++++++++++[>+++++++++++<-]>+.>++++++++++[>+++++++++++<-]>++++.>++++++++++[>++++++++++<-]>++++++++.>++++++++++[>++++++++++<-]>.>

++++++++[>++++++++<-]>+++++++.>++++++++++[>+++++++++++<-]>+.>++++++++++[>+++++++++++<-]>+.>++++++++++[>++++++++++<-]>.>+++++++++[>++++++++++<-]>++++++++.>+++++++++++[>+++++++++++<-]>.>++++++++++[>++++++++++<-]>+.>+++++[>++++++<-]>++.>++++++++[>++++++++<-]>++.>++++++++++[>+++++++++++<-]>++++.>+++++++++[>++++++++++<-]>+++++++.>++++++++++[>++++++++++<-]>+++++.>++++++++++[>+++++++++++<-]>.>++++++++++[>++++++++++<-]>++.>++++++++++[>+++++++++++<-]>+++++++.>+++++++++[>+++++++++++<-]>.>++++++++++[>++++++++++<-]>+++++++.>