Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <cstdio>
#include <iostream>
#include <string>
#include <set>
int main(){
int n; std::cin >> n;
std::set<std::pair<std::string, std::string> > leaves;
while(n--){
std::string s1, s2; std::cin >> s1 >> s2;
leaves.insert(std::pair<std::string, std::string>(s1, s2));
}
std::cout << leaves.size() << std::endl;
return 0;
}
Copy The Code &
Try With Live Editor
Input
5
birch yellow
maple red
birch yellow
maple yellow
maple green
birch yellow
maple red
birch yellow
maple yellow
maple green
Output
4
Demonstration
Codeforces Solution-A. Indian Summer-Solution in C, C++, Java, Python