Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- char findTheDifference(string s, string t) {
- char ta[123] = { 0 };
- for (char c: t) {
- ta[c]++;
- }
- for (char c: s) {
- ta[c]--;
- }
- for (char i = 97; i < 123; i++) {
- if (ta[i] > 0) {
- return i;
- }
- }
- return 'a';
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement