using System;
namespace ImgurLinkConverter
{
class Program
{
static void Main(string[] args)
{
//Console.Write("Input imgur link: ");
//string link = Console.ReadLine();
//Console.Write(ConvertLink(link));
Console.Write(ConvertLink());
Console.ReadKey();
}
private static string ConvertLink(string link)
{
if (
!link.Contains("/a/") &&
link.Contains("https://i...content-available-to-author-only...r.com/")
)
{
link = link.Insert(8, "i.");
return link + ".png";
}
return "Invalid link";
}
private static string ConvertLink()
{
string link = "https://i...content-available-to-author-only...r.com/imSB81I";
return ConvertLink(link);
}
}
}
dXNpbmcgU3lzdGVtOwoKbmFtZXNwYWNlIEltZ3VyTGlua0NvbnZlcnRlcgp7CiAgICBjbGFzcyBQcm9ncmFtCiAgICB7CiAgICAgICAgc3RhdGljIHZvaWQgTWFpbihzdHJpbmdbXSBhcmdzKQogICAgICAgIHsKICAgICAgICAgICAgLy9Db25zb2xlLldyaXRlKCJJbnB1dCBpbWd1ciBsaW5rOiAiKTsKICAgICAgICAgICAgLy9zdHJpbmcgbGluayA9IENvbnNvbGUuUmVhZExpbmUoKTsKICAgICAgICAgICAgLy9Db25zb2xlLldyaXRlKENvbnZlcnRMaW5rKGxpbmspKTsKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZShDb252ZXJ0TGluaygpKTsKICAgICAgICAgICAgQ29uc29sZS5SZWFkS2V5KCk7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBzdHJpbmcgQ29udmVydExpbmsoc3RyaW5nIGxpbmspCiAgICAgICAgewogICAgICAgICAgICBpZiAoCiAgICAgICAgICAgICAgICAhbGluay5Db250YWlucygiL2EvIikgJiYKICAgICAgICAgICAgICAgIGxpbmsuQ29udGFpbnMoImh0dHBzOi8vaS4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4uci5jb20vIikKICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgbGluayA9IGxpbmsuSW5zZXJ0KDgsICJpLiIpOwogICAgICAgICAgICAgICAgcmV0dXJuIGxpbmsgKyAiLnBuZyI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiAiSW52YWxpZCBsaW5rIjsKICAgICAgICB9CgogICAgICAgIHByaXZhdGUgc3RhdGljIHN0cmluZyBDb252ZXJ0TGluaygpCiAgICAgICAgewogICAgICAgICAgICBzdHJpbmcgbGluayA9ICJodHRwczovL2kuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLnIuY29tL2ltU0I4MUkiOwogICAgICAgICAgICByZXR1cm4gQ29udmVydExpbmsobGluayk7CiAgICAgICAgfQogICAgfQp9