I posted similar question
conditional count in a list of strings in SQL Oracle
this time the dataset is row wise but the logic remains the same. the items will