-
Notifications
You must be signed in to change notification settings - Fork 126
/
solucao.cs
60 lines (53 loc) · 1.72 KB
/
solucao.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**********************************************************************************************
*
* 5/5 - Pedro Bento e o Mundo de OZ
*
******************************** Desafio:
*
* No jogo, O Mundo de Oz, Pedro Bento é o líder do Tribunal, por causa disso ele é uma das
* pessoas mais importantes do mundo, no jogo. Além disso, Pedro Bento possui um grande tesouro,
* o qual possui diversos tipos de jóias.
*
* Pedro Bento está muito curioso para saber quantos tipos de jóias diferentes seu tesouro
* possui.
*
* Sabendo que você é o melhor programador do mundo, Pedro Bento te contratou para verificar
* quantos tipos de jóias distintas ele tem em seu tesouro.
*
******************************** Entrada:
*
* A entrada consiste de várias linhas e cada uma contém uma string que descreve uma das
* jóias de Pedro Bento. Essa string é composta apenas dos caracteres '(' e ')', a soma do
* tamanho de todas as string não excede 106.
*
******************************** Saída:
*
* Imprima quantos tipos de jóias distintas Pedro Bento possui.
*
**********************************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
class PedroBentoEOMundoDeOZ
{
static void Main(string[] args)
{
string joia = "";
List<string> joias = new List<string>();
do
{
joia = Console.ReadLine();
if (!string.IsNullOrWhiteSpace(joia))
{
joias.Add(joia);
}
else
{
break;
}
}
while (true);
IEnumerable<string> distinctJoias = joias.Distinct();
Console.WriteLine(distinctJoias.Count());
}
}