-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathisSubsequence.java
More file actions
24 lines (23 loc) · 1.12 KB
/
isSubsequence.java
File metadata and controls
24 lines (23 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public class Main {
public static void main(String[] args) {
String s = "mjmqqjrmzkvhxlyruonekhhofpzzslupzojfuoztvzmmqvmlhgqxehojfowtrinbatjujaxekbcydldglkbxsqbbnrkhfdnpfbuaktupfftiljwpgglkjqunvithzlzpgikixqeuimmtbiskemplcvljqgvlzvnqxgedxqnznddkiujwhdefziydtquoudzxstpjjitmiimbjfgfjikkjycwgnpdxpeppsturjwkgnifinccvqzwlbmgpdaodzptyrjjkbqmgdrftfbwgimsmjpknuqtijrsnwvtytqqvookinzmkkkrkgwafohflvuedssukjgipgmypakhlckvizmqvycvbxhlljzejcaijqnfgobuhuiahtmxfzoplmmjfxtggwwxliplntkfuxjcnzcqsaagahbbneugiocexcfpszzomumfqpaiydssmihdoewahoswhlnpctjmkyufsvjlrflfiktndubnymenlmpyrhjxfdcq";
String t = "rjufvjafbxnbgriwgokdgqdqewn";
int flag = 0;
int start = 0;
for (int i = 0; i < t.length(); i++) {
char temp = t.charAt(i);
for (int j = start; j < s.length(); j++) {
if (temp == s.charAt(j)) {
start = j + 1;
flag++;
break;
}
}
}
if (flag == t.length())
System.out.println("true");
else {
System.out.println("false");
}
}
}