using System;
using System.Collections.Generic;
using System.Linq;

namespace MyCompiler 
{
    class Program 
    {
        public static void Main(string[] args) 
        {
            Console.WriteLine("Hello world!");
            anag("car", "race");
            anag("bag", "grab");
        }
        
        public static void anag(string str1, string str2)
        {
            List<string> lis = new List<string>();
            foreach(char ele in str1)
            {
                string res = ele.ToString();
                foreach(char item in str1)
                {
                    if(ele  != item)
                    {
                        res +=  item.ToString();
                        foreach(char obj in str1)
                        {
                           if(!(res.Contains(obj)))
                           {
                             res += obj.ToString();
                             lis.Add(res);
                           }
                        }
                    }
                    res = ele.ToString();
                }
                
            }
            Console.WriteLine( lis.Count(x => str2.Contains(x)) > 0 ? true : false);
            
        }
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: