Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program Chef decided to find the connections with all of his friends in an unnamed social network. He calls a user of the social

C++ program

Chef decided to find the connections with all of his friends in an unnamed social network. He calls a user of the social network his friend if there is a common substring of the string "chef" and the nickname of that user with length ? 2. Given a list of users of the social network, compute the number of Chef's friends. Input The first line of the input contains a single integer N denoting the number of users in the social network. N lines follow. Each of these lines contains a single string u denoting the nickname of one user. Output Print a single line containing one integer the number of Chef's friends. Input 4 gennady.korotkevich kefaa fhlasek chemthan Output 3 Explanations: 1. gennady.korotkevich is a friend to Chef because he has "ch" at the end of his nickname, which is also a substring of "chef" with length 2. 2. the common substring with kefaa is "ef" and the common substring with chemthan is "che"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions