---
# System prepended metadata

title: 2351. First Letter to Appear Twice
tags: [Leetcode, Easy]

---

# 2351. First Letter to Appear Twice
###### tags: `Leetcode` `Easy`
Link: https://leetcode.com/problems/first-letter-to-appear-twice/description/
## Code
```java=
class Solution {
    public char repeatedCharacter(String s) {
        boolean[] exists = new boolean[26];
        for(int i=0; i<s.length(); i++){
            if(exists[s.charAt(i)-'a']) return s.charAt(i);
            exists[s.charAt(i)-'a'] = true;
        }
        return 'a';
    }
}
```
