using System.Collections.Generic;
public class VirtusaHomeTest
private static readonly APIProblem aPIProblem;
private static readonly StringProblem stringProblem;
aPIProblem = new APIProblem();
stringProblem = new StringProblem();
public static void Main()
Console.WriteLine("\n1. String difference solution");
Console.WriteLine("2. API solution");
Console.WriteLine("Choose: ");
int n = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter first string");
string str1 = Console.ReadLine();
Console.WriteLine("Enter second string");
string str2 = Console.ReadLine();
stringProblem.StringDifference(str1.ToUpper(), str2.ToUpper());
aPIProblem.ShowEmailsForAll();
public class StringProblem
public void StringDifference(string str1, string str2)
StringBuilder out1 = new StringBuilder();
StringBuilder out2 = new StringBuilder();
client = new HttpClient();
userIds = new List<int> { 1, 3, 10 };
public void ShowEmailsForAll()
foreach (int i in userIds)
var res = client.GetAsync($"https://reqres.in/api/users/{i}").Result;
if (res.IsSuccessStatusCode)
Console.WriteLine(JsonConvert.DeserializeObject<UserResponse>(res.Content.ReadAsStringAsync()?.Result)?.UserDetails?.Email);
public class UserResponse
public UserDetails UserDetails { get; set; }
public long Id { get; set; }
public string Email { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
public Uri Avatar { get; set; }