So I have my code right here. And the problem is this:


The input contains several test cases. Each is specified by two strings s, t of alphanumeric ASCII characters separated by whitespace. The length of s and t will be no more than 100000.


For each test case output "Yes", if s is a sub-sequence of t, otherwise output "No".

Sample Input

sequence  subsequence
person    compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter  CaseDoesMatter

Sample Output



My Code:

#include <stdio.h>
#include <string.h>

int main(){

FILE * fp = fopen("", "r");
int x, y, found = 0;
char s[100];
char t[100];

while(fscanf(fp, "%s %s", s, t) != EOF){
for(x = 0; x < strlen(s); x++){
for(y = 0; y < strlen(t); y++){
if(s[x] == t[y]){

(found == strlen(s) || strstr(t,s)) ? printf("Yes!\n") : printf("No!\n");
found = 0;

My problem is, what if, the inputs will have the same letter?

for example:

VIVA   VitaminIgniteVoltAge
there are two letter Vs, so the found value will be equal to 6.
therefore, it's not equal since the length of the word VIVA is only 4 and the found is 6.

can anyone help me?
Do you have any suggestions? or can you improve the solution I've made?

Here's a sample run.