mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-10-14 18:18:23 +00:00
[Init] Solved solutions
This commit is contained in:
1 parent
51f667ac81
commit
20542601dd
131 files changed
+4148
No files matched your search
+44
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
|
||||
namespace _518B
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string s = Console.ReadLine();
|
||||
string t = Console.ReadLine();
|
||||
int[] c1 = new int[52];
|
||||
int[] c2 = new int[52];
|
||||
for (int i = 0; i < s.Length; i++)
|
||||
{
|
||||
if (char.IsLower(s[i]))
|
||||
{
|
||||
c1[s[i] - 'a']++;
|
||||
}
|
||||
else
|
||||
{
|
||||
c1[s[i] - 'A' + 26]++;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < t.Length; i++)
|
||||
{
|
||||
if (char.IsLower(t[i]))
|
||||
{
|
||||
c2[t[i] - 'a']++;
|
||||
}
|
||||
else
|
||||
{
|
||||
c2[t[i] - 'A' + 26]++;
|
||||
}
|
||||
}
|
||||
int y = 0, w = 0;
|
||||
for (int i = 0; i < 26; i++)
|
||||
{
|
||||
y += Math.Min(c1[i], c2[i]) + Math.Min(c1[i + 26], c2[i + 26]);
|
||||
w += Math.Min(Math.Max(c1[i] - c2[i], 0), Math.Max(c2[i + 26] - c1[i + 26], 0)) + Math.Min(Math.Max(c1[i + 26] - c2[i + 26], 0), Math.Max(c2[i] - c1[i], 0));
|
||||
}
|
||||
Console.WriteLine("{0} {1}", y, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user