Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Advertising
- {
- static void Main()
- {
- //Telerik Academy
- //How many times you could write the word TAT with the letters given on the 3 input lines.
- string input1 = Console.ReadLine(),
- input2 = Console.ReadLine(),
- input3 = Console.ReadLine();
- string allInput = input1 + input2 + input3;
- int counterT = 0,
- counterA = 0,
- counterAdvertisments = 0;
- foreach (char item in allInput)
- {
- if (item == 'T')
- {
- counterT++;
- }
- if (item == 'A')
- {
- counterA++;
- }
- }
- while (counterT >= 2 && counterA > 0)
- {
- counterAdvertisments++;
- counterA--;
- counterT = counterT - 2;
- }
- Console.WriteLine(counterAdvertisments);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement